NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

SortedList.Item

Gets and sets the value associated with a specific key in the SortedList.

[C#] In C#, this member is the indexer for the SortedList class.

[Visual Basic]
Overridable Public Default Property Item( _
   ByVal key As Object _
) As Object
[C#]
public object this[
   object key
] {virtual get; virtual set;}
[C++]
public: __property virtual Object* get_Item(
   Object* key
);
public: __property virtual void set_Item(
   Object* key,
   Object*
);
[JScript]
returnValue = SortedListObject.Item(key);
SortedListObject.Item(key) = returnValue;
-or-
returnValue = SortedListObject(key);
SortedListObject(key) = returnValue;

[JScript] In JScript, you can use the default indexed properties defined by a type, but you cannot explicitly define your own. However, specifying the expando attribute on a class automatically provides a default indexed Item property whose type is Object and whose index type is String.

Arguments [JScript]

key
The key associated with the value to get or set.

Parameters [Visual Basic, C#, C++]

key
The key associated with the value to get or set.

Property Value

The value associated with key in the SortedList, if key is found; otherwise, a null reference (in Visual Basic Nothing).

Exceptions

Exception Type Condition
ArgumentNullException key is a null reference (Nothing).

Remarks

If setting the value of key and key does not exist in the SortedList, a new entry is created with the specified key and the specified value.

A value in the SortedList can be a null reference (Nothing). To distinguish between a null that is returned because the specified key is not found and a null that is returned because the value of the specified key is a null reference (Nothing), use the Contains method or the ContainsKey method to determine if the key exists in the list.

See Also

SortedList Class | SortedList Members | System.Collections Namespace | Add | Contains | ContainsKey