Share via


GraphNodeCollection Class

Definition

This class provides methods for manipulating a collection of Nodes. This class does not preserve the order in which you added the nodes, so when you enumerate them you will get them back in a random order.

public ref class GraphNodeCollection sealed : Microsoft::VisualStudio::GraphModel::IReadOnlyCollection<Microsoft::VisualStudio::GraphModel::GraphNode ^>, System::Collections::Generic::ICollection<Microsoft::VisualStudio::GraphModel::GraphNode ^>, System::Collections::Generic::IEnumerable<Microsoft::VisualStudio::GraphModel::GraphNode ^>
public sealed class GraphNodeCollection : Microsoft.VisualStudio.GraphModel.IReadOnlyCollection<Microsoft.VisualStudio.GraphModel.GraphNode>, System.Collections.Generic.ICollection<Microsoft.VisualStudio.GraphModel.GraphNode>, System.Collections.Generic.IEnumerable<Microsoft.VisualStudio.GraphModel.GraphNode>
type GraphNodeCollection = class
    interface ICollection<GraphNode>
    interface seq<GraphNode>
    interface IEnumerable
    interface IReadOnlyCollection<GraphNode>
    interface IHasGraphOwner
Public NotInheritable Class GraphNodeCollection
Implements ICollection(Of GraphNode), IEnumerable(Of GraphNode), IReadOnlyCollection(Of GraphNode)
Inheritance
GraphNodeCollection
Implements

Properties

Containers

Returns an enumerable which consists of all nodes that are containers.

Count

Return the number of nodes in the collection.

Graph

Gets the Graph associated with this nodes collection

IsReadOnly

Gets a value indicating whether the System.Collections.Generic.ICollection is read-only.

Item[String]

Gets the Node using the given id. Throws exception on set if another node with the same id already exists.

Owner

Gets the Graph associated with this nodes collection

Methods

Add(GraphNode, GraphNode)

Adds the specified node to the graph.

Add(GraphNode)

Adds a link to the graph, or merge it with an existing Link object

Add(IEnumerable<GraphNode>)

Add all the nodes in the given set.

Clear()

Remove all nodes in the collection

Contains(GraphNode)

Determines if the given node is in this collection

CopyTo(GraphNode[], Int32)

Copies the elements of the System.Collections.Generic.ICollection to an System.Array, starting at a particular System.Array index.

CreateNew(String)

Add a new node using the given base name format for the node. This method formats the given string with integer values until it finds an id that is not currently in use, then creates a node with that id.

Get(GraphNodeId)

Gets the node with the specified id

Get(String)

Gets the node with the specified id

GetByCategory(GraphCategory[])

Returns all nodes in the graph that have at least one of the specified categories or have inherited categories that are in the set. For example, if we have a Class category that inherits from the Type category and we ask for all nodes that have a Type category then it will return nodes that have either Class or Type categories. However, if we ask for "Class" categories it will only return nodes with a Class category, it will not return nodes that only have a "Type" category. In otherwords, it does not expand the search to include BasedOn categories of the given set, to do that you must call HasCategoryInSet with GraphCategoryMatchOption.Inherit.

GetByCategory(String[])

Returns all nodes in the graph that have the specified categories

GetByProperty(GraphProperty, Object)

Returns all nodes in the graph that have the specified property value.

GetEnumerator()

Gets the typed enumerator for this collection

GetFiltered(Predicate<GraphNode>)

Returns all nodes in the graph that match according to the given filter

GetOrCreate(GraphNodeId, String, GraphCategory)

Attempts to get the node with the specified id. If not found, it will create a new node.

GetOrCreate(GraphNodeId)

Attempts to get the node with the specified id. If not found, it will create a new node.

GetOrCreate(String, String, GraphCategory)

Attempts to get the node with the specified id. If not found, it will create a new node.

GetOrCreate(String)

Attempts to get the node with the specified id. If not found, it will create a new node.

Remove(GraphNode, GraphNode)

Remove the specified node

Remove(GraphNode)

Removes the first occurrence of a specific object from the System.Collections.Generic.ICollection.

Remove(GraphNodeId)

Remove the specified node

Remove(IEnumerable<GraphNode>)

Remove all the nodes in the given set.

Remove(String)

Remove the specified node

Events

Added

This event is raised immediately when a new node is added to the collection.

Removed

This event is raised immediately when a node is removed from the collection.

Explicit Interface Implementations

IEnumerable.GetEnumerator()

Gets the enumerator for this collection

Extension Methods

EmptyIfNull<T>(IEnumerable<T>)

Return this enumeration in case it is not null. In case it is null return empty enumeration.

Applies to