Partilhar via


ModelElementExtensionMethods.TryGetExtension Method

Definition

Overloads

TryGetExtension(ModelElement, DomainClassInfo)
TryGetExtension(ModelElement, Guid)
TryGetExtension(ModelElement, Type)
TryGetExtension<T>(ModelElement)

Get the ExtensionElement of the specified type from the available extensions of this ModelElement. If this element has no such extension then the result will be null.

TryGetExtension(ModelElement, DomainClassInfo)

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::VisualStudio::Modeling::ExtensionElement ^ TryGetExtension(Microsoft::VisualStudio::Modeling::ModelElement ^ element, Microsoft::VisualStudio::Modeling::DomainClassInfo ^ extensionClass);
public static Microsoft.VisualStudio.Modeling.ExtensionElement TryGetExtension (this Microsoft.VisualStudio.Modeling.ModelElement element, Microsoft.VisualStudio.Modeling.DomainClassInfo extensionClass);
static member TryGetExtension : Microsoft.VisualStudio.Modeling.ModelElement * Microsoft.VisualStudio.Modeling.DomainClassInfo -> Microsoft.VisualStudio.Modeling.ExtensionElement
<Extension()>
Public Function TryGetExtension (element As ModelElement, extensionClass As DomainClassInfo) As ExtensionElement

Parameters

element
ModelElement
extensionClass
DomainClassInfo

Returns

Applies to

TryGetExtension(ModelElement, Guid)

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::VisualStudio::Modeling::ExtensionElement ^ TryGetExtension(Microsoft::VisualStudio::Modeling::ModelElement ^ element, Guid extensionClassId);
public static Microsoft.VisualStudio.Modeling.ExtensionElement TryGetExtension (this Microsoft.VisualStudio.Modeling.ModelElement element, Guid extensionClassId);
static member TryGetExtension : Microsoft.VisualStudio.Modeling.ModelElement * Guid -> Microsoft.VisualStudio.Modeling.ExtensionElement
<Extension()>
Public Function TryGetExtension (element As ModelElement, extensionClassId As Guid) As ExtensionElement

Parameters

element
ModelElement
extensionClassId
Guid

Returns

Applies to

TryGetExtension(ModelElement, Type)

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::VisualStudio::Modeling::ExtensionElement ^ TryGetExtension(Microsoft::VisualStudio::Modeling::ModelElement ^ element, Type ^ extensionType);
public static Microsoft.VisualStudio.Modeling.ExtensionElement TryGetExtension (this Microsoft.VisualStudio.Modeling.ModelElement element, Type extensionType);
static member TryGetExtension : Microsoft.VisualStudio.Modeling.ModelElement * Type -> Microsoft.VisualStudio.Modeling.ExtensionElement
<Extension()>
Public Function TryGetExtension (element As ModelElement, extensionType As Type) As ExtensionElement

Parameters

element
ModelElement
extensionType
Type

Returns

Applies to

TryGetExtension<T>(ModelElement)

Get the ExtensionElement of the specified type from the available extensions of this ModelElement. If this element has no such extension then the result will be null.

public:
generic <typename T>
 where T : Microsoft::VisualStudio::Modeling::ExtensionElement[System::Runtime::CompilerServices::Extension]
 static T TryGetExtension(Microsoft::VisualStudio::Modeling::ModelElement ^ element);
public static T TryGetExtension<T> (this Microsoft.VisualStudio.Modeling.ModelElement element) where T : Microsoft.VisualStudio.Modeling.ExtensionElement;
static member TryGetExtension : Microsoft.VisualStudio.Modeling.ModelElement -> 'T (requires 'T :> Microsoft.VisualStudio.Modeling.ExtensionElement)
<Extension()>
Public Function TryGetExtension(Of T As ExtensionElement) (element As ModelElement) As T

Type Parameters

T

The type of ExtensionElement to retrieve

Parameters

element
ModelElement

The extended ModelElement

Returns

T

The ExtensionElement of the requested type, or null if the element has no such extension

Applies to