Share via


Expression2.Name 屬性

取得物件的名稱。

命名空間:  EnvDTE100
組件:  EnvDTE100 (在 EnvDTE100.dll 中)

語法

'宣告
ReadOnly Default Property Name As String
    Get
string this { get; }
property String^ default {
    String^ get ();
}
abstract Name : string
function get Name () : String

屬性值

型別:System.String
表示物件名稱的字串。

實作

Expression.Name

範例

下列範例示範如何使用 Name 屬性。

若要測試這個屬性:

  1. 在目標應用程式中設定中斷點。

  2. 在偵錯模式執行目標應用程式。

  3. 當應用程式在中斷點停止時,請執行增益集。

public static void Name(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("Name 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 Name(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 安全性

請參閱

參考

Expression2 介面

Name 多載

EnvDTE100 命名空間

其他資源

HOW TO:編譯和執行 Automation 物件模型程式碼範例