In This Topic
Gets or sets the value associated with the specified key.
Syntax
'Declaration
<__DynamicallyInvokableAttribute()>
Public Default Property Item( _
ByVal As System.Integer _
) As System.String
'Usage
Dim instance As Errors
Dim key As System.Integer
Dim value As System.String
instance.Item(key) = value
value = instance.Item(key)
[__DynamicallyInvokable()]
public System.string this[
System.int
]; {get; set;}
Parameters
- key
- The key of the value to get or set.
Property Value
The value associated with the specified key. If the specified key is not found, a get operation throws a
System.Collections.Generic.KeyNotFoundException, and a set operation creates a new element with the specified key.
Exceptions
Exception | Description |
System.ArgumentNullException | is a null reference (Nothing in Visual Basic). |
System.Collections.Generic.KeyNotFoundException | The property is retrieved and does not exist in the collection. |
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
See Also