Share via


Expression2.Type Property

Gets a constant indicating the object type.

Namespace:  EnvDTE100
Assembly:  EnvDTE100 (in EnvDTE100.dll)

Syntax

'Declaration
ReadOnly Property Type As String
    Get
string Type { get; }
property String^ Type {
    String^ get ();
}
abstract Type : string
function get Type () : String

Property Value

Type: System.String
A string constant representing the object type.

Implements

Expression.Type

Remarks

Returns a string of the type of expression, such as "int", "CString", or "char."

Examples

The following example demonstrates how to use the Type property.

To test this property:

  1. Set a breakpoint in your target application.

  2. Run the target application in the debug mode.

  3. When the application stops at the breakpoint, run the add-in.

public static void Type(DTE dte)
{
    // Setup debug Output window.
    Window w = (Window)dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
    w.Visible = true;
    OutputWindow ow = (OutputWindow)w.Object;
    OutputWindowPane owp = ow.OutputWindowPanes.Add("Type property: ");
    owp.Activate();

    EnvDTE100.Expression2 exp = dte.Debugger.GetExpression("tempC", true, 1);
    owp.OutputString("\nThe name of the expression: " + exp.Name);
    owp.OutputString("\nThe type of the expression: " + exp.Type);
    owp.OutputString("\nThe value of the expression: " + exp.Value);
}
Shared Sub Type(ByRef dte As EnvDTE.DTE)
    Dim exp As EnvDTE100.Expression2 = dte.Debugger.GetExpression("tempC", True, 1)
    Dim str As String
    str = "The name of the expression: " + exp.Name
    str += vbCrLf + "The type of the expression: " + exp.Type
    str += vbCrLf + "The value of the expression: " + exp.Value
    MessageBox.Show(str, "Expression Test - Name, Type, Value Properties")
End Sub

.NET Framework Security

See Also

Reference

Expression2 Interface

Type Overload

EnvDTE100 Namespace

Other Resources

How to: Compile and Run the Automation Object Model Code Examples