| 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
truethrows 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.| Exception | Description |
|---|---|
| ServiceResultException | If cannot convert value. |
If throwOnError is
false the default value for the type is returned if the value is not valid.Target Platforms: Windows 7/8/10, Windows Server 2003/2008/2012/2015, .NET4.x