AFKeyedResults(TKey, TResult).TryGetValue Method
- Last UpdatedNov 18, 2025
- 2 minute read
- PI System
- AF SDK 2024 R2
- Developer
Gets the value associated with the specified key.
Namespace: OSIsoft.AF
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public bool TryGetValue( TKey key, out TResult value )
Public Function TryGetValue ( key As TKey, <OutAttribute> ByRef value As TResult ) As Boolean Dim instance As AFKeyedResults Dim key As TKey Dim value As TResult Dim returnValue As Boolean returnValue = instance.TryGetValue(key, value)
public: bool TryGetValue( TKey key, [OutAttribute] TResult% value )
member TryGetValue : key : 'TKey * value : 'TResult byref -> bool
Parameters
- key
- Type: TKey
The key whose value to get. - value
- Type: TResult
When this method returns, the value associated with the specified key if the key is found. Otherwise, the default value for the type of the value.
Return Value
Type: BooleanReturns if the Results contains an item with the specified key. Otherwise, fals is returned.
Exceptions
| Exception | Condition |
|---|---|
| ArgumentNullException | Thrown when the requested key is . |
Remarks
If the key is not found, then the value parameter gets
the appropriate default value for the value type TValue. For example, zero (0) for
integer types, for Boolean types, and for
reference types.