Compares a Node to a String
            
            
            
            | C# |  Copy Code | 
|---|---|
| //define our 2 String ids, and then define our node to use the first id. String id1 = "Hello", id2 = "World"; NodeId node1 = new NodeId(id1); //now to compare the node to the guids Utils.Trace("\n\nComparing NodeId to String"); 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 |  Copy Code | 
|---|---|
| 'define our 2 String ids, and then define our node to use the first id. Dim id1 As String = "Hello" Dim id2 As String = "World" Dim node1 As NodeId = New NodeId(id1) 'now to compare the node to the guids Utils.Trace("Comparing NodeId to String"); 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 {1} = [equals] {2}", id1, id2, node1.Equals(id2))); Utils.Trace(String.Format("Comparing {0} to {1} = [ = ] {2}", id1, id2, node1 = id2)); | |
Target Platforms: Windows 7/8/10, Windows Server 2003/2008/2012/2015, .NET4.x
 
     
     
     
     
    