GraphNodeId Class
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
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
System.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 | |
---|---|---|
Empty | ||
LiteralValue | Gets a literal value for the GraphNodeId. Uses the Name if the GraphNodeIdName is a Literal; otherwise delegates to ToString. | |
Name | The GraphNodeIdName. | |
Value | The value of the GraphNodeId. This can be one of: * String * Uri * GraphNodeId * GraphNodeIdCollection. |
Top
Methods
Name | Description | |
---|---|---|
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. | |
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. | |
CompareTo(Object) | Compares to another GraphNodeId. | |
CompareTo(GraphNodeId) | Compares to another GraphNodeId. | |
Equals | See whether this GraphNodeId matches either a GraphNodeId or a GraphNodeIdKey. (Overrides Object.Equals(Object).) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetArray(GraphNodeIdName, array<GraphNodeId[]) | Constructs a partial GraphNodeId based on the given array name and identifiers. | |
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. | |
GetHashCode | Gets the HashCode. We return the hashcode given to us during construction. (Overrides Object.GetHashCode().) | |
GetLiteral | Gets a literal GraphNodeId parsed from the given identifier string. | |
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. | |
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. | |
GetNestedIdByName | Gets a value from the first embedded GraphNodeId that matches the name. | |
GetNestedValueByName<T> | Gets a value from the first embedded GraphNodeId that matches the name. | |
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. | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GetValue<T> | The value of the GraphNodeId. This can be one of: * String * Uri * GraphNodeId * GraphNodeIdCollection. | |
IsNullOrEmpty | ||
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Parse(String) | Parses a string into a GraphNodeId. | |
Parse(String, Boolean) | Parses a string into a GraphNodeId. | |
Parse(String, Boolean, Func<Int32, GraphNodeId>) | Parse a string into a GraphNodeId | |
RemovedNestedNames | Returns a partial GraphNodeId that contains the given GraphNodeIdName. | |
ToString | Gets a string for the GraphNodeId. (Overrides Object.ToString().) |
Top
Operators
Name | Description | |
---|---|---|
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. | |
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 | |
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 | |
---|---|---|
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.