共用方式為


ModelElement.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 the specified ModelElement. If the element has no such extension then the result will be null.

TryGetExtension(ModelElement, DomainClassInfo)

public:
 static Microsoft::VisualStudio::Modeling::ExtensionElement ^ TryGetExtension(Microsoft::VisualStudio::Modeling::ModelElement ^ element, Microsoft::VisualStudio::Modeling::DomainClassInfo ^ extensionClass);
public static Microsoft.VisualStudio.Modeling.ExtensionElement TryGetExtension (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
Public Shared Function TryGetExtension (element As ModelElement, extensionClass As DomainClassInfo) As ExtensionElement

Parameters

element
ModelElement
extensionClass
DomainClassInfo

Returns

Applies to

TryGetExtension(ModelElement, Guid)

public:
 static Microsoft::VisualStudio::Modeling::ExtensionElement ^ TryGetExtension(Microsoft::VisualStudio::Modeling::ModelElement ^ element, Guid extensionClassId);
public static Microsoft.VisualStudio.Modeling.ExtensionElement TryGetExtension (Microsoft.VisualStudio.Modeling.ModelElement element, Guid extensionClassId);
static member TryGetExtension : Microsoft.VisualStudio.Modeling.ModelElement * Guid -> Microsoft.VisualStudio.Modeling.ExtensionElement
Public Shared Function TryGetExtension (element As ModelElement, extensionClassId As Guid) As ExtensionElement

Parameters

element
ModelElement
extensionClassId
Guid

Returns

Applies to

TryGetExtension(ModelElement, Type)

public:
 static Microsoft::VisualStudio::Modeling::ExtensionElement ^ TryGetExtension(Microsoft::VisualStudio::Modeling::ModelElement ^ element, Type ^ extensionType);
public static Microsoft.VisualStudio.Modeling.ExtensionElement TryGetExtension (Microsoft.VisualStudio.Modeling.ModelElement element, Type extensionType);
static member TryGetExtension : Microsoft.VisualStudio.Modeling.ModelElement * Type -> Microsoft.VisualStudio.Modeling.ExtensionElement
Public Shared 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 the specified ModelElement. If the element has no such extension then the result will be null.

public:
generic <typename T>
 where T : Microsoft::VisualStudio::Modeling::ExtensionElement static T TryGetExtension(Microsoft::VisualStudio::Modeling::ModelElement ^ element);
public static T TryGetExtension<T> (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)
Public Shared 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