GraphLinkCollection.GetOrCreate Method (String, String, String, GraphCategory)

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 String, _
    targetId As String, _
    label As String, _
    category As GraphCategory _
) As GraphLink
public GraphLink GetOrCreate(
    string sourceId,
    string targetId,
    string label,
    GraphCategory category
)
public:
GraphLink^ GetOrCreate(
    String^ sourceId, 
    String^ targetId, 
    String^ label, 
    GraphCategory^ category
)
member GetOrCreate : 
        sourceId:string * 
        targetId:string * 
        label:string * 
        category:GraphCategory -> GraphLink
public function GetOrCreate(
    sourceId : String, 
    targetId : String, 
    label : String, 
    category : GraphCategory
) : GraphLink

Parameters

  • sourceId
    Type: String

    source of the link

  • targetId
    Type: String

    target of the link

  • label
    Type: String

    displayable label of the 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

See Also

Reference

GraphLinkCollection Class

GetOrCreate Overload

Microsoft.VisualStudio.GraphModel Namespace