Expression.Value 属性

设置或获取该对象的数据。

命名空间:  EnvDTE
程序集:  EnvDTE(在 EnvDTE.dll 中)

语法

声明
Property Value As String
string Value { get; set; }
property String^ Value {
    String^ get ();
    void set (String^ value);
}
abstract Value : string with get, set
function get Value () : String 
function set Value (value : String)

属性值

类型:String
表示对象的值的字符串。

备注

如果特性为 name(someval, 2) 形式,则该值为 someval, 2。

示例

下面的示例演示如何使用 Value 属性。

测试此属性:

  1. 在目标应用程序中设置一个断点。

  2. 以调试模式运行目标应用程序。

  3. 当此应用程序停在该断点处时,运行外接程序。

public static void Value(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("Value property: ");
    owp.Activate();

    EnvDTE.Expression 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 Value(ByRef dte As EnvDTE.DTE)
    Dim exp As EnvDTE.Expression = 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 安全性

请参阅

参考

Expression 接口

EnvDTE 命名空间

其他资源

如何:编译和运行自动化对象模型代码示例