Partager via


Item Property

Gets or sets a dictionary value, based upon the key.

Namespace:  Microsoft.CommerceServer.Runtime.Targeting
Assembly:  Microsoft.CommerceServer.Runtime (in Microsoft.CommerceServer.Runtime.dll)

Syntax

'Declaration
Public Property Item ( _
    key As String _
) As Object
'Usage
Dim instance As ContentSelectionContext
Dim key As String
Dim value As Object

value = instance.Item(key)

instance.Item(key) = value
public Object Item[
    string key
] { get; set; }
public:
property Object^ Item[String^ key] {
    Object^ get (String^ key);
    void set (String^ key, Object^ value);
}
JScript does not support indexed properties.

Parameters

Property Value

Type: System..::.Object
The value associated with the specified key, or a nullNothingnullptra null reference (Nothing in Visual Basic) reference (Nothing in Visual Basic) if key is not in the dictionary or key is of a type that is not assignable to the key type TKey of the Dictionary.

Remarks

This property provides the ability to access a specific value in the collection by using the following C# syntax: myCollection[key] (myCollection(key) in Visual Basic).

You can also use the Item property to add new elements by setting the value of a key that does not exist in the dictionary; for example, myCollection["myNonexistentKey"] = myValue. However, if the specified key already exists in the dictionary, setting the Item property overwrites the old value.

Permissions

See Also

Reference

ContentSelectionContext Class

ContentSelectionContext Members

Microsoft.CommerceServer.Runtime.Targeting Namespace