Επεξεργασία

Κοινή χρήση μέσω


PropertyCollection.IDictionary.Contains(Object) Method

Definition

Determines whether the IDictionary object contains an element with the specified key.

 virtual bool System.Collections.IDictionary.Contains(System::Object ^ value) = System::Collections::IDictionary::Contains;
bool IDictionary.Contains (object value);
abstract member System.Collections.IDictionary.Contains : obj -> bool
override this.System.Collections.IDictionary.Contains : obj -> bool
Function Contains (value As Object) As Boolean Implements IDictionary.Contains

Parameters

value
Object

The key to locate in the IDictionary object.

Returns

true if the IDictionary contains an element with the key; otherwise, false.

Implements

Exceptions

key is null.

Examples

The following example demonstrates how to implement the Contains method. This example is part of a larger example provided for the IDictionary class.

public:
    virtual bool Contains(Object^ key)
    {
        int index;
        return TryGetIndexOfKey(key, &index);
    }
public bool Contains(object key)
{
   Int32 index;
   return TryGetIndexOfKey(key, out index);
}
Public Function Contains(ByVal key As Object) As Boolean Implements IDictionary.Contains
    Dim index As Integer
    Return TryGetIndexOfKey(key, index)
End Function

Applies to