'Declaration
<CanBeNullAttribute()> Property ValueType As Type
'Usage
Dim instance As _UAWriteArguments Dim value As Type instance.ValueType = value value = instance.ValueType
[CanBeNull()] Type ValueType {get; set;}
'Declaration
<CanBeNullAttribute()> Property ValueType As Type
'Usage
Dim instance As _UAWriteArguments Dim value As Type instance.ValueType = value value = instance.ValueType
[CanBeNull()] Type ValueType {get; set;}
The value of this property is not used when the OpcLabs.EasyOpc.UA.OperationModel.UAAttributeArguments.AttributeId is other than OpcLabs.EasyOpc.UA.UAAttributeId.Value.
A null
value in this property means that the component will determine the type of the Value attribute from the DataType and ValueRank attributes of the node first. This can have negative implication on the performance, and introduces a dependency of the value written on the behavior of the OPC server itself.
This method or property does not throw any exceptions, aside from execution exceptions such as System.Threading.ThreadAbortException or System.OutOfMemoryException.
// This example shows how to write values into 3 nodes at once, specifying a type explicitly. It tests for success of each // write and displays the exception message in case of failure. // // Reasons for specifying the type explicitly might be: // - The data type in the server has subtypes, and the client therefore needs to pick the subtype to be written. // - The data type that the reports is incorrect. // - Writing with an explicitly specified type is more efficient. // // Alternative ways of specifying the type are using the ValueTypeCode or ValueTypeFullName properties. using System; using OpcLabs.BaseLib.OperationModel; using OpcLabs.EasyOpc.UA; using OpcLabs.EasyOpc.UA.OperationModel; namespace UADocExamples._EasyUAClient { partial class WriteMultipleValues { public static void ValueType() { UAEndpointDescriptor endpointDescriptor = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"; // or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported) // or "https://opcua.demo-this.com:51212/UA/SampleServer/" // Instantiate the client object var client = new EasyUAClient(); // Modify value of a node OperationResult[] operationResultArray = client.WriteMultipleValues(new[] { new UAWriteValueArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10221", 23456) {ValueType = typeof(Int32)}, // here is the type explicitly specified new UAWriteValueArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10226", "This string cannot be converted to Double") {ValueType = typeof(Double)}, // here is the type explicitly specified new UAWriteValueArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;s=UnknownNode", "ABC") {ValueType = typeof(string)} // here is the type explicitly specified }); for (int i = 0; i < operationResultArray.Length; i++) if (operationResultArray[i].Succeeded) Console.WriteLine("Result {0}: success", i); else Console.WriteLine("Result {0}: {1}", i, operationResultArray[i].Exception.GetBaseException().Message); } } }
' This example shows how to write values into 3 nodes at once, specifying a type explicitly. It tests for success of each ' write and displays the exception message in case of failure. ' ' Reasons for specifying the type explicitly might be: ' - The data type in the server has subtypes, and the client therefore needs to pick the subtype to be written. ' - The data type that the reports is incorrect. ' - Writing with an explicitly specified type is more efficient. ' ' Alternative ways of specifying the type are using the ValueTypeCode or ValueTypeFullName properties. Imports System Imports OpcLabs.BaseLib.OperationModel Imports OpcLabs.EasyOpc.UA Imports OpcLabs.EasyOpc.UA.OperationModel Namespace _EasyUAClient Partial Friend Class WriteMultipleValues Public Shared Sub ValueType() ' Define which server we will work with. Dim endpointDescriptor As UAEndpointDescriptor = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer" ' or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported) ' or "https://opcua.demo-this.com:51212/UA/SampleServer/" ' Instantiate the client object Dim client = New EasyUAClient() ' Modify value of a node Dim operationResultArray() As OperationResult = client.WriteMultipleValues(New UAWriteValueArguments() _ { _ New UAWriteValueArguments(endpointDescriptor, _ "nsu=http://test.org/UA/Data/ ;i=10221", 23456) _ With {.ValueType = GetType(Int32)}, _ New UAWriteValueArguments(endpointDescriptor, _ "nsu=http://test.org/UA/Data/ ;i=10226", "This string cannot be converted to Double") _ With {.ValueType = GetType(Double)}, _ New UAWriteValueArguments(endpointDescriptor, _ "nsu=http://test.org/UA/Data/ ;s=UnknownNode", "ABC") _ With {.ValueType = GetType(String)} _ } _ ) For i As Integer = 0 To operationResultArray.Length - 1 If operationResultArray(i).Succeeded Then Console.WriteLine("Result {0}: success", i) Else Console.WriteLine("Result {0}: {1}", i, operationResultArray(i).Exception.GetBaseException().Message) End If Next i End Sub End Class End Namespace