ConditionalWeakTable<TKey, TValue>.TryGetValue Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets the value of the specified key.
Assembly: mscorlib (in mscorlib.dll)
| Exception | Condition |
|---|---|
| ArgumentNullException | key is null. |
The following example defines a MainClass class and a MainInfo class, which provides information about the MainClass instance. The example calls the Add, GetOrCreateValue, and GetValue methods to add key/value pairs to a ConditionalWeakTable<TKey, TValue> table. In each case, the example calls the TryGetValue method to confirm that the key/value pair has been added to the table.
- SecurityCriticalAttribute
requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.