This operator allows you to compare a NodeId to an array of Bytes.
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# | ![]() |
---|---|
//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 Basic | ![]() |
---|---|
'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) ) |
Target Platforms: Windows 7/8/10, Windows Server 2003/2008/2012/2015, .NET4.x