NameValueCollection.Item Property (String)
Assembly: System (in system.dll)
/** @property */ public String get_Item (String name) /** @property */ public void set_Item (String name, String value)
The String key of the entry to locate. The key can be a null reference (Nothing in Visual Basic).
Property ValueA String that contains the comma-separated list of values associated with the specified key, if found; otherwise, a null reference (Nothing in Visual Basic).
The collection is read-only and the operation attempts to modify the collection.
This property provides the ability to access a specific element in the collection by using the following syntax: myCollection[name].
If the specified key already exists in the collection, setting this property overwrites the existing list of values with the specified value. To append the new value to the existing list of values, use the Add method.
If the specified key does not exist in the collection, setting this property creates a new entry using the specified key and the specified value.
This property returns a null reference (Nothing in Visual Basic) in the following cases: 1) if the specified key is not found; and 2) if the specified key is found and its associated value is a null reference (Nothing in Visual Basic). This property does not distinguish between the two cases.
The C# language uses the this keyword to define the indexers instead of implementing the Item property. Visual Basic implements Item as a default property, which provides the same indexing functionality.
Retrieving or setting the values associated with the specified key is an O(n) operation, where n is the number of values.
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.