Condividi tramite


IDictionary.Values Proprietà

Definizione

Ottiene un ICollection oggetto contenente i valori nell'oggetto IDictionary .

public:
 property System::Collections::ICollection ^ Values { System::Collections::ICollection ^ get(); };
public System.Collections.ICollection Values { get; }
member this.Values : System.Collections.ICollection
Public ReadOnly Property Values As ICollection

Valore della proprietà

Oggetto ICollection contenente i valori nell'oggetto IDictionary .

Esempio

Nell'esempio di codice seguente viene illustrato come implementare la Values proprietà . Questo esempio di codice fa parte di un esempio più ampio fornito per la IDictionary classe .

public ICollection Values
{
    get
    {
        // Return an array where each item is a value.
        Object[] values = new Object[ItemsInUse];
        for (Int32 n = 0; n < ItemsInUse; n++)
            values[n] = items[n].Value;
        return values;
    }
}
Public ReadOnly Property Values() As ICollection Implements IDictionary.Values
    Get
        ' Return an array where each item is a value.
        Dim valueArray() As Object = New Object(ItemsInUse - 1) {}
        Dim n As Integer
        For n = 0 To ItemsInUse - 1
            valueArray(n) = items(n).Value
        Next n

        Return valueArray
    End Get
End Property

Commenti

L'ordine dei valori nell'oggetto restituito ICollection non è specificato, ma è garantito che sia lo stesso ordine delle chiavi corrispondenti nell'oggetto ICollection restituito dalla Keys proprietà .

Si applica a

Vedi anche