GraphLinkCollection.GetOrCreate Method (GraphNodeId, GraphNodeId, String, GraphCategory)
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Attempts to get the link with the specified source, target.
If not found, a new link will be created.
It also adds the specified category if it is not already defined.
It also creates the source and target Node if those are not already defined (and these are created with no category).
Namespace: Microsoft.VisualStudio.GraphModel
Assembly: Microsoft.VisualStudio.GraphModel (in Microsoft.VisualStudio.GraphModel.dll)
Syntax
'Declaration
Public Function GetOrCreate ( _
sourceId As GraphNodeId, _
targetId As GraphNodeId, _
label As String, _
category As GraphCategory _
) As GraphLink
public GraphLink GetOrCreate(
GraphNodeId sourceId,
GraphNodeId targetId,
string label,
GraphCategory category
)
public:
GraphLink^ GetOrCreate(
GraphNodeId^ sourceId,
GraphNodeId^ targetId,
String^ label,
GraphCategory^ category
)
member GetOrCreate :
sourceId:GraphNodeId *
targetId:GraphNodeId *
label:string *
category:GraphCategory -> GraphLink
public function GetOrCreate(
sourceId : GraphNodeId,
targetId : GraphNodeId,
label : String,
category : GraphCategory
) : GraphLink
Parameters
sourceId
Type: Microsoft.VisualStudio.GraphModel.GraphNodeIdThe source node
targetId
Type: Microsoft.VisualStudio.GraphModel.GraphNodeIdThe target node
label
Type: System.StringThe displayable label of the link
category
Type: Microsoft.VisualStudio.GraphModel.GraphCategoryAn initial category to add to this link
Return Value
Type: Microsoft.VisualStudio.GraphModel.GraphLink
The Link that was found or created
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | thrown is sourceId or targetId is null or empty string |
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.