AFAnalysisService.RuntimeFieldValue.ToObject(T) Method (T)
- Last UpdatedNov 18, 2025
- 2 minute read
- PI System
- AF SDK 2024 R2
- Developer
Converts the value to an object of the specified type or the specified default value.
Namespace: OSIsoft.AF.Analysis
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public T ToObject<T>( T defaultValue )
Public Function ToObject(Of T) ( defaultValue As T ) As T Dim instance As AFAnalysisServiceRuntimeFieldValue Dim defaultValue As T Dim returnValue As T returnValue = instance.ToObject(defaultValue)
public: generic<typename T> T ToObject( T defaultValue )
member ToObject : defaultValue : 'T -> 'T
Parameters
- defaultValue
- Type: T
The default value to return if field value cannot be converted to the specified type.
Type Parameters
- T
- The following types are supported: String, Int32, Int64, Double, AFTime, and Guid (for .NET 4 only).
Return Value
Type: TValue converted to the specified type, or in case the conversion failed, the value specified by defaultValue.
Exceptions
| Exception | Condition |
|---|---|
| InvalidOperationException | Thrown when unsupported type T is specified. |