다음을 통해 공유


DictionaryEntry.Key 속성

정의

키/값 쌍의 키를 가져오거나 설정합니다.

public:
 property System::Object ^ Key { System::Object ^ get(); void set(System::Object ^ value); };
public object Key { get; set; }
member this.Key : obj with get, set
Public Property Key As Object

속성 값

키/값 쌍의 키입니다.

예제

다음 예제에서는 속성을 보여 줍니다 Key . 이 코드 예제는 클래스에 제공된 더 큰 예제의 DictionaryEntry 일부입니다.

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 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

적용 대상