Properties.Item(Object) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回 Properties 集合的一个索引成员。
public:
EnvDTE::Property ^ Item(System::Object ^ index);
public:
EnvDTE::Property ^ Item(Platform::Object ^ index);
EnvDTE::Property Item(winrt::Windows::Foundation::IInspectable const & index);
[System.Runtime.InteropServices.DispId(0)]
public EnvDTE.Property Item (object index);
[<System.Runtime.InteropServices.DispId(0)>]
abstract member Item : obj -> EnvDTE.Property
Public Function Item (index As Object) As Property
参数
返回
Property 对象。
- 属性
示例
public void CodeExample(DTE2 dte)
{
try
{ // Open a solution before running this example
Properties props = dte.Solution.Properties;
Property prop;
string msg;
msg = "How many properties are there in the current solution: " + props.Count.ToString();
msg += "\nThe application containing this Properties collection is " + props.DTE.Name;
msg += "\nThe parent object of the Properties collection is a " + ((Solution)props.Parent).FullName;
msg += "\nThe application property returns : " + ((DTE2)props.Application).Name;
if (props.Count > 0)
{
prop = props.Item(1);
msg += "\nThe first Property in the Properties collection is " + prop.Name;
}
MessageBox.Show(msg);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
注解
传递给的值 Index 是集合中对象的索引值 Property Properties 或 Property 集合中对象的名称。
Item ArgumentException 如果在集合中找不到指定的值,该方法将引发异常。