T
The framework type of value contained in the variable.
EasyUA Reference
CheckTypeBeforeCast<T> Method
See Also  Send Feedback
Opc.Ua.Core.Net4 Assembly > Opc.Ua Namespace > BaseVariableState Class : CheckTypeBeforeCast<T> Method

value
The value.
throwOnError
if set to trueServiceResultException is thrown on error.

Glossary Item Box

Checks the data type of a value before casting it to the type T.

Syntax

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

Parameters

value
The value.
throwOnError
if set to trueServiceResultException is thrown on error.

Type Parameters

T
The framework type of value contained in the variable.

Return Value

Returns value or default for T

Exceptions

ExceptionDescription
ServiceResultExceptionif it is impossible to cast the value or the value is null and IsValueType for the type T returns true.

Requirements

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

See Also

Copyright © 2018 Advosol Inc. All Rights Reserved.