Freigeben über


DictionaryEntry.Value-Eigenschaft

Ruft den Wert im Schlüssel-Wert-Paar ab oder legt diesen fest.

Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Property Value As Object
'Usage
Dim instance As DictionaryEntry
Dim value As Object

value = instance.Value

instance.Value = value
public Object Value { get; set; }
public:
property Object^ Value {
    Object^ get ();
    void set (Object^ value);
}
/** @property */
public Object get_Value ()

/** @property */
public void set_Value (Object value)
public function get Value () : Object

public function set Value (value : Object)

Eigenschaftenwert

Der Wert im Schlüssel-Wert-Paar.

Beispiel

Im folgenden Beispiel wird die Value-Eigenschaft veranschaulicht. Dieses Codebeispiel ist Teil eines umfangreicheren Beispiels für die DictionaryEntry-Klasse.

Public Sub Add(ByVal key As Object, ByVal value As Object) Implements IDictionary.Add

    ' Add the new key/value pair even if this key already exists in the dictionary.
    If ItemsInUse = items.Length Then
        Throw New InvalidOperationException("The dictionary cannot hold any more items.")
    End If
    items(ItemsInUse) = New DictionaryEntry(key, value)
    ItemsInUse = ItemsInUse + 1
End Sub
public void Add(object key, object value) 
{
    // Add the new key/value pair even if this key already exists in the dictionary.
    if (ItemsInUse == items.Length)
        throw new InvalidOperationException("The dictionary cannot hold any more items.");
    items[ItemsInUse++] = new DictionaryEntry(key, value);
}
public:
    virtual void Add(Object^ key, Object^ value)
    {
        // Add the new key/value pair even if this key already exists
        // in the dictionary.
        if (itemsInUse == items->Length)
        {
            throw gcnew InvalidOperationException
                ("The dictionary cannot hold any more items.");
        }
        items[itemsInUse++] = gcnew DictionaryEntry(key, value);
    }

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

DictionaryEntry-Struktur
DictionaryEntry-Member
System.Collections-Namespace