GraphNodeId Class

A GraphNodeId is a name/value pair, for example "a=b". The left part of this identifier ("a") is represented by a GraphNodeIdName called the "name" and the right hand side, "b" is the "value" part. The value part of a GraphNodeId can be one of the following: * String * Uri * GraphNodeId * GraphNodeIdCollection. Since the Value can be a GraphNodeId or GraphNodeIdCollection, we can use parentheses "()" to specify nesting: e.g., a=(b=c) a=(b=c d=e) (a=b c=d). To construct a nested GraphNodeId list for (a=b c=d), create a GraphNodeIdCollection and assign it to a GraphNodeId:

GraphNodeId.Get(GraphNodeIdName.Nested, new GraphNodeIdCollection( GraphNodeId.Get(MyGraphNodeIdNames.a, "b") GraphNodeId.Get(MyGraphNodeIdNames.c, "d"));

You can also create this GraphNodeId by using the following simple arithmetic:

GraphNodeId ab = GraphNodeId.Get("(a=b)");

GraphNodeId abcd = ab + "(c=d)";

// Yields (a=b c=d)

The result can be converted to a string by using ToString() or an implicit string cast operator and will produce "(a=b c=d)".

Since GraphNodeIds are stored singleton in a HashSet, they can be compared using operator ==.

Inheritance Hierarchy

Object
  Microsoft.VisualStudio.GraphModel.GraphNodeId

Namespace:  Microsoft.VisualStudio.GraphModel
Assembly:  Microsoft.VisualStudio.GraphModel (in Microsoft.VisualStudio.GraphModel.dll)

Syntax

'Declaration
<SerializableAttribute> _
<TypeConverterAttribute(GetType(GraphNodeIdConverter))> _
Public Class GraphNodeId _
    Implements IEquatable(Of GraphNodeId), IComparable(Of GraphNodeId),  _
    IComparable
[SerializableAttribute]
[TypeConverterAttribute(typeof(GraphNodeIdConverter))]
public class GraphNodeId : IEquatable<GraphNodeId>, 
    IComparable<GraphNodeId>, IComparable
[SerializableAttribute]
[TypeConverterAttribute(typeof(GraphNodeIdConverter))]
public ref class GraphNodeId : IEquatable<GraphNodeId^>, 
    IComparable<GraphNodeId^>, IComparable
[<SerializableAttribute>]
[<TypeConverterAttribute(typeof(GraphNodeIdConverter))>]
type GraphNodeId =  
    class 
        interface IEquatable<GraphNodeId>
        interface IComparable<GraphNodeId>
        interface IComparable 
    end
public class GraphNodeId implements IEquatable<GraphNodeId>, IComparable<GraphNodeId>, IComparable

The GraphNodeId type exposes the following members.

Properties

  Name Description
Public propertyStatic member Empty
Public property LiteralValue Gets a literal value for the GraphNodeId. Uses the Name if the GraphNodeIdName is a Literal; otherwise delegates to ToString.
Public property Name The GraphNodeIdName.
Public property Value The value of the GraphNodeId. This can be one of: * String * Uri * GraphNodeId * GraphNodeIdCollection.

Top

Methods

  Name Description
Public method Add Adds a GraphNodeId. If this identifier already is an array, the item is added to the array. Otherwise, a new embedded array is returned.
Public method AppendToString Appends the "ToString" of a GraphNodeId to the StringBuilder. This is more efficient than calling ToString, as the GraphNodeId can re-use the StringBuilder.
Public method CompareTo(Object) Compares to another GraphNodeId.
Public method CompareTo(GraphNodeId) Compares to another GraphNodeId.
Public method Equals See whether this GraphNodeId matches either a GraphNodeId or a GraphNodeIdKey. (Overrides Object.Equals(Object).)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodStatic member GetArray(GraphNodeIdName, array<GraphNodeId[]) Constructs a partial GraphNodeId based on the given array name and identifiers.
Public methodStatic member GetArray(GraphNodeIdName, Object) Get a GraphNodeId based on the name and value. Does a lookup against a Dictionary to minimize the number of GraphNodeIds around.
Public method GetHashCode Gets the HashCode. We return the hashcode given to us during construction. (Overrides Object.GetHashCode.)
Public methodStatic member GetLiteral Gets a literal GraphNodeId parsed from the given identifier string.
Public methodStatic member GetNested(array<GraphNodeId[]) Gets a nested GraphNodeId based on the given identifiers. Does a lookup against a Dictionary to minimize the number of GraphNodeIds around.
Public methodStatic member GetNested(GraphNodeIdName, Object) Gets a GraphNodeId based on the name and value. Does a lookup against a Dictionary to minimize the number of GraphNodeIds around.
Public method GetNestedIdByName Gets a value from the first embedded GraphNodeId that matches the name.
Public method GetNestedValueByName<T> Gets a value from the first embedded GraphNodeId that matches the name.
Public methodStatic member GetPartial Gets a partial GraphNodeId based on the name and value. Does a lookup against a Dictionary to minimize the number of GraphNodeIds around. It is generally not right to get a partial GraphNodeId and use it for a node ID. Always use a full Nested GraphNodeId.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method GetValue<T> The value of the GraphNodeId. This can be one of: * String * Uri * GraphNodeId * GraphNodeIdCollection.
Public methodStatic member IsNullOrEmpty
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public methodStatic member Parse(String) Parses a string into a GraphNodeId.
Public methodStatic member Parse(String, Boolean) Parses a string into a GraphNodeId.
Public methodStatic member Parse(String, Boolean, Func<Int32, GraphNodeId>)
Public method RemovedNestedNames Returns a partial GraphNodeId that contains the given GraphNodeIdName.
Public method ToString Gets a string for the GraphNodeId. (Overrides Object.ToString.)

Top

Operators

  Name Description
Public operatorStatic member Addition The + operator adds two GraphNodeIds. If either GraphNodeId is already contain an array, the item is added to the array. Otherwise, a new embedded array is returned.
Public operatorStatic member Equality The == operator compares two GraphNodeIds and returns whether they are equal. The first GraphNodeId to add. The second GraphNodeId to add. True if the GraphNodeIds are Equal; false otherwise
Public operatorStatic member Inequality The != operator compares two GraphNodeIds and returns whether they are equal. The first GraphNodeId to add. The second GraphNodeId to add. False if the GraphNodeId are equal; true otherwise

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method IEquatable<GraphNodeId>.Equals

Top

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.VisualStudio.GraphModel Namespace