PropertyCollection.IDictionary.Contains(Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET