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
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈