更新:2007 年 11 月
获取对象的名称。
命名空间: EnvDTE
程序集: EnvDTE(在 EnvDTE.dll 中)
语法
声明
ReadOnly Property Name As String
用法
Dim instance As [Property]
Dim value As String
value = instance.Name
string Name { get; }
property String^ Name {
String^ get ();
}
function get Name () : String
属性值
表示对象名称的字符串值。
示例
public void CodeExample(DTE2 dte)
{
try
{ // Open a solution before running this example
Properties props = dte.Solution.Properties;
Property prop;
string msg = "";
if (props.Count > 0)
{
prop = props.Item(1); // Get first property
msg += "\nThis Property is named: " + prop.Name;
msg += "\nThis Property is located in a collection within
the following solution: " +
((Solution)prop.Collection.Parent).FullName;
if (prop.Parent.Equals(prop.Collection))
msg += "\nThe parent and collection properties return
the same object.";
msg += "\nThe DTE property returns: " + prop.DTE.Name;
}
MessageBox.Show(msg, "Property Object");
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
权限
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。