Condividi tramite


ModelElement.AddExtension Method (ModelElement, ExtensionElement)

Extend the specified ModelElement with a specified extension. An InvalidOperationException will be thrown if the element already has an extension of the same type.

Namespace:  Microsoft.VisualStudio.Modeling
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.10.0 (in Microsoft.VisualStudio.Modeling.Sdk.10.0.dll)

Syntax

'Dichiarazione
Public Shared Function AddExtension ( _
    element As ModelElement, _
    extension As ExtensionElement _
) As ExtensionElement
public static ExtensionElement AddExtension(
    ModelElement element,
    ExtensionElement extension
)
public:
static ExtensionElement^ AddExtension(
    ModelElement^ element, 
    ExtensionElement^ extension
)
static member AddExtension : 
        element:ModelElement * 
        extension:ExtensionElement -> ExtensionElement 
public static function AddExtension(
    element : ModelElement, 
    extension : ExtensionElement
) : ExtensionElement

Parameters

Return Value

Type: Microsoft.VisualStudio.Modeling.ExtensionElement
The added extension

Remarks

Although attempts to add a duplicate extension type are caught here, there are other cases where extensions may clash by contributing duplicate properties or roles, for example when two extensions are added that inherit from a common base that defines IMS properties and/or roles. Such cases are detected by IMergeElements implementation on ModelElement, but not by this low-level API

.NET Framework Security

See Also

Reference

ModelElement Class

AddExtension Overload

Microsoft.VisualStudio.Modeling Namespace