_DTE.GetObject(String) Method

Definition

Gets an interface or object that is late-bound to the DTE object and can be accessed by name at run time.

C++/CX
public:
 Platform::Object ^ GetObject(Platform::String ^ Name);

Parameters

Name
String

Required. The name of the object to retrieve.

Returns

An interface or object that is late-bound to the DTE object.

Attributes

Examples

VB
Sub GetObjectExample(ByVal dte As DTE2)  

    ' NOTE: This example requires a reference to the   
    '       Microsoft.VisualStudio.VCCodeModel namespace.  

    Dim idents() As String = {"short", "class", "void", "var"}  
    Dim langMan As VCLanguageManager = _  
        CType(dte.GetObject("VCLanguageManager"), VCLanguageManager)  

    ' Validate the names in idents.  
    Dim name, msg As String  
    For Each name In idents  
        If langMan.ValidateIdentifier(name) Then  
            msg &= """" & name & """ is a valid identifier." & vbCrLf  
        Else  
            msg &= """" & name & """ is not a valid identifier." & _  
                vbCrLf  
        End If  
    Next  

    MsgBox(msg)  
End Sub  

Remarks

GetObject is most useful in languages that do not support early binding. In this case, you can name the specific interface or object you want, for example, DTE.GetObject("VCProjects").

IExtenderSite.GetObject only supports the value "DTE" as the Name parameter. This is provided for Extender Providers to get to the DTE object.

Applies to

Proizvod Verzije
Visual Studio SDK 2015, 2017, 2019