T
The framework type of value contained in this instance.
EasyUA Reference
ExtractValueFromVariant<T>(ISystemContext,Object,Boolean) Method
See Also  Send Feedback
Opc.Ua.Core.Net4 Assembly > Opc.Ua Namespace > BaseVariableState Class > ExtractValueFromVariant Method : ExtractValueFromVariant<T>(ISystemContext,Object,Boolean) Method

context
The context.
value
The value.
throwOnError
if set to true throws the ServiceResultException on error, otherwise default value for T is returned .

Glossary Item Box

Converts a values contained in a variant to the value defined for the variable.

Syntax

Visual Basic (Usage)Copy Code
Dim context As ISystemContext
Dim value As Object
Dim throwOnError As Boolean
Dim value As Object
 
value = BaseVariableState.ExtractValueFromVariant(Of T)(context, value, throwOnError)
C# 
public static object ExtractValueFromVariant<T>( 
   ISystemContext context,
   object value,
   bool throwOnError
)

Parameters

context
The context.
value
The value.
throwOnError
if set to true throws the ServiceResultException on error, otherwise default value for T is returned .

Type Parameters

T
The framework type of value contained in this instance.

Return Value

The value of the T type.

Exceptions

ExceptionDescription
ServiceResultExceptionIf cannot convert value.

Remarks

If throwOnError is false the default value for the type is returned if the value is not valid.

Requirements

Target Platforms: Windows 7/8/10, Windows Server 2003/2008/2012/2015, .NET4.x

See Also

Copyright © 2018 Advosol Inc. All Rights Reserved.