Converts a NodeId into a Guid allowing you to compare a Node against a Guid.
This produces the following output (taken from C# example):
Comparing NodeId to GUID
Comparing bbe8b5f2-0f50-4302-877f-346afb07704c to bbe8b5f2-0f50-4302-877f-346afb07704c = [equals] True
Comparing bbe8b5f2-0f50-4302-877f-346afb07704c to bbe8b5f2-0f50-4302-877f-346afb07704c = [ = ] True
Comparing bbe8b5f2-0f50-4302-877f-346afb07704c to e707de86-4c11-4fe6-94b2-83638a9427e6 = [equals] False
Comparing bbe8b5f2-0f50-4302-877f-346afb07704c to e707de86-4c11-4fe6-94b2-83638a9427e6 = [ = ] False
C# | ![]() |
---|---|
//define our 2 GUID ids, and then define our node to use the first id. Guid id1 = Guid.NewGuid(), id2 = Guid.NewGuid(); NodeId node1 = new NodeId(id1); //now to compare the node to the guids Utils.Trace("\n\nComparing NodeId to GUID"); Utils.Trace("\tComparing {0} to {0} = [equals] {2}", id1, id1, node1.Equals(id1)); Utils.Trace("\tComparing {0} to {0} = [ == ] {2}", id1, id1, node1 == id1); Utils.Trace("\tComparing {0} to {1} = [equals] {2}", id1, id2, node1.Equals(id2)); Utils.Trace("\tComparing {0} to {1} = [ == ] {2}", id1, id2, node1 == id2); |
Visual Basic | ![]() |
---|---|
'define our 2 GUID ids, and then define our node to use the first id. Dim id1 As Guid = Guid.NewGuid() Dim id2 As Guid = Guid.NewGuid() Dim node1 As NodeId = new NodeId(id1) 'now to compare the node to the guids Utils.Trace("Comparing NodeId to GUID") Utils.Trace( String.Format( " Comparing {0} to {0} = [equals] {2}", id1, id1, node1.Equals(id1)) ); Utils.Trace( String.Format( " Comparing {0} to {0} = [ = ] {2}", id1, id1, node1 = id1) ); Utils.Trace( String.Format( " Comparing {0} to {0} = [equals] {2}", id1, id2, node1.Equals(id2)) ); Utils.Trace( String.Format( " Comparing {0} to {0} = [ = ] {2}", id1, id2, node1 = id2) ); |
Target Platforms: Windows 7/8/10, Windows Server 2003/2008/2012/2015, .NET4.x