Επεξεργασία

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


KeyedCollection<TKey,TItem>.TryGetValue(TKey, TItem) Method

Definition

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

Parameters

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.

Returns

true if an item for the specified key was found in the collection; otherwise, false.

Exceptions

key is null.

Applies to