EasyUA Reference
Implicit Type Conversion(NodeId,Byte[]) Operator
See Also  Example Send Feedback
Opc.Ua.Core.Net4 Assembly > Opc.Ua Namespace > NodeId Class > Implicit Type Conversion Operator : Implicit Type Conversion(NodeId,Byte[]) Operator
value
The System.Byte[] array to compare this node to

Glossary Item Box

Converts a byte array to an opaque node identifier.

Syntax

Visual Basic (Usage)Copy Code
C# 
public NodeId operator implicit( 
   byte[] value
)

Parameters

value
The System.Byte[] array to compare this node to

Remarks

This operator allows you to compare a NodeId to an array of Bytes.

Example

This produces the following output (taken from C# example):

Comparing NodeId to Byte[] Comparing ABCDE to ABCDE = [equals] True Comparing ABCDE to ABCDE = [ == ] True Comparing ABCDE to abcde = [equals] False Comparing ABCDE to abcde = [ == ] False

C#Copy Code
//define our 2 Byte[] ids, and then define our node to use the first id.
byte[] id1 = new byte[] { 65, 66, 67, 68, 69 };
byte[] id2 = new byte[] { 97, 98, 99, 100, 101 };
NodeId node1 = new NodeId(id1);
            
//convert our bytes to string so we can display them 
string id1String = System.Text.ASCIIEncoding.ASCII.GetString(id1);
string id2String = System.Text.ASCIIEncoding.ASCII.GetString(id2);
            
//now to compare the node to the guids
Utils.Trace("\n\nComparing NodeId to Byte[]");
Utils.Trace("\tComparing {0} to {0} = [equals] {2}", id1String, id1String, node1.Equals(id1));
Utils.Trace("\tComparing {0} to {0} = [  =   ] {2}", id1String, id1String, node1 == id1);
Utils.Trace("\tComparing {0} to {1} = [equals] {2}", id1String, id2String, node1.Equals(id2));
Utils.Trace("\tComparing {0} to {1} = [  =   ] {2}", id1String, id2String, node1 == id2);
Visual BasicCopy Code
'define our 2 Byte[] ids, and then define our node to use the first id.
Dim id1 As Byte() = New Byte() { 65, 66, 67, 68, 69 }
Dim id2 As Byte() = New Byte() { 97, 98, 99, 100, 101 }
Dim node1 As NodeId = New NodeId(id1)
            
'convert our bytes to string so we can display them 
Dim id1String As String = System.Text.ASCIIEncoding.ASCII.GetString(id1)
Dim id2String As String = System.Text.ASCIIEncoding.ASCII.GetString(id2)
            
'now to compare the node to the guids
Utils.Trace("Comparing NodeId to Byte()")
Utils.Trace( String.Format("Comparing {0} to {0} = [equals] {2}", id1String, id1String, node1.Equals(id1)) )
Utils.Trace( String.Format("Comparing {0} to {0} = [  =   ] {2}", id1String, id1String, node1 = id1) )
Utils.Trace( String.Format("Comparing {0} to {1} = [equals] {2}", id1String, id2String, node1.Equals(id2)) )
Utils.Trace( String.Format("Comparing {0} to {1} = [  =   ] {2}", id1String, id2String, node1 = id2) )

Requirements

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

See Also

Copyright © 2018 Advosol Inc. All Rights Reserved.