Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

AFKeyedResults(TKey, TResult).TryGetValue Method

  • Last UpdatedNov 18, 2025
  • 2 minute read
AFKeyedResults(TKey, TResult).TryGetValue Method
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: Boolean
Returns if the Results contains an item with the specified key. Otherwise, fals is returned.

Exceptions

ExceptionCondition
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.

Version Information

AFSDK


See Also

In This Topic
TitleResults for “How to create a CRG?”Also Available in