Connectivity Software User's Guide and Reference
ToGoodValueResult<TValue>(Func<Exception,Exception>) Method



OpcLabs.EasyOpcUAPrimitives Assembly > OpcLabs.EasyOpc.UA.OperationModel Namespace > UAAttributeDataResult Class > ToGoodValueResult Method : ToGoodValueResult<TValue>(Func<Exception,Exception>) Method
The target type for the value.
A function to transform exceptions before including them in the result.

The value of this parameter cannot be null (Nothing in Visual Basic).

Converts this attribute data result to a strongly-typed OpcLabs.BaseLib.OperationModel.Generic.ValueResult<T>, ensuring the status is good and converting the value to the specified type.
Syntax
'Declaration
 
<JetBrains.Annotations.NotNullAttribute()>
Public Overloads Function ToGoodValueResult(Of TValue)( _
   ByVal exceptionTransformingFunction As Func(Of Exception,Exception) _
) As ValueResult(Of TValue)
'Usage
 
Dim instance As UAAttributeDataResult
Dim exceptionTransformingFunction As Func(Of Exception,Exception)
Dim value As ValueResult(Of TValue)
 
value = instance.ToGoodValueResult(Of TValue)(exceptionTransformingFunction)
[JetBrains.Annotations.NotNull()]
public ValueResult<TValue> ToGoodValueResult<TValue>( 
   Func<Exception,Exception> exceptionTransformingFunction
)
[JetBrains.Annotations.NotNull()]
public:
ValueResult<TValue^>^ ToGoodValueResultgeneric<typename TValue>
( 
   Func<Exception^,Exception^>^ exceptionTransformingFunction
) 

Parameters

exceptionTransformingFunction
A function to transform exceptions before including them in the result.

The value of this parameter cannot be null (Nothing in Visual Basic).

Type Parameters

TValue
The target type for the value.

Return Value

A strongly-typed OpcLabs.BaseLib.OperationModel.Generic.ValueResult<T> with the value converted to TValue.

This method never returns null (Nothing in Visual Basic).

Remarks

This method first ensures the status is good, then attempts to convert the value to the specified type. Any conversion errors are included as exceptions in the returned result.

This method or property does not throw any exceptions, aside from execution exceptions such as System.Threading.ThreadAbortException or System.OutOfMemoryException.

Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also