ModelElementExtensionMethods.TryGetExtension 方法

定義

多載

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

從這個 ModelElement 的可用延伸中取得指定類型的 ExtensionElement。 如果這個元素沒有這類的副檔名,則結果將會是 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

參數

element
ModelElement
extensionClass
DomainClassInfo

傳回

ExtensionElement

適用於

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

參數

element
ModelElement
extensionClassId
Guid

傳回

ExtensionElement

適用於

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

參數

element
ModelElement
extensionType
Type

傳回

ExtensionElement

適用於

TryGetExtension<T>(ModelElement)

從這個 ModelElement 的可用延伸中取得指定類型的 ExtensionElement。 如果這個元素沒有這類的副檔名,則結果將會是 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

類型參數

T

要取出的 ExtensionElement 類型

參數

element
ModelElement

擴充的 ModelElement

傳回

T

要求類型的 ExtensionElement,如果元素沒有這類延伸,則為 null

適用於