Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

_DTE.GetObject Method

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

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)
Object GetObject(
	string Name


Type: System.String
Required. The name of the object to retrieve.

Return Value

Type: System.Object
An interface or object that is late-bound to the DTE object.

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.

public void GetObjectExample(DTE2 dte)
    // NOTE: This example requires a reference to the 
    //       Microsoft.VisualStudio.VCCodeModel namespace.

    string[] idents = {"short", "class", "void", "var"};
    VCLanguageManager langMan = 

    // Validate the names in idents.
    string msg = "";
    foreach (string name in idents)
        if (langMan.ValidateIdentifier(name))
            msg += "\"" + name + "\" is a valid identifier." + 
            msg += "\"" + name + "\" is not a valid identifier." + 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.