KeyedCollection<TKey,TItem>.TryGetValue(TKey, TItem) Method
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.
Tries to get an item from the collection using the specified key.
public:
bool TryGetValue(TKey key, [Runtime::InteropServices::Out] TItem % item);
public bool TryGetValue (TKey key, out TItem item);
member this.TryGetValue : 'Key * 'Item -> bool
Public Function TryGetValue (key As TKey, ByRef item As TItem) As Boolean
- key
- TKey
The key of the item to search in the collection.
- item
- TItem
When this method returns true
, the item from the collection that matches the provided key; when this method returns false
, the default
value for the type of the collection.
true
if an item for the specified key was found in the collection; otherwise, false
.
key
is null
.
Product | Versions |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Standard | 2.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: