Projects.Item(Object) Projects.Item(Object) Projects.Item(Object) Projects.Item(Object) Projects.Item(Object) Projects.Item(Object) Method

Definition

Returns an indexed member of a Projects collection.

public:
 EnvDTE::Project ^ Item(System::Object ^ index);
public:
 EnvDTE::Project ^ Item(Platform::Object ^ index);
EnvDTE::Project Item(winrt::Windows::Foundation::IInspectable const & index);
[System.Runtime.InteropServices.DispId(0)]
public EnvDTE.Project Item (object index);
abstract member Item : obj -> EnvDTE.Project
Public Function Item (index As Object) As Project
Parameters
index
Object Object Object Object Object Object

Required. The index of the item to return.

Returns

Examples

public void CodeExample(DTE2 dte)  
{    
    try  
    {   // Open a project before running this sample  
        Projects prjs = dte.Solution.Projects;  
        string msg = "There are " + prjs.Count.ToString() + " projects in this collection.";  
        msg += "
The application containing this Projects collection: " + prjs.DTE.Name; msg += "
The parent object of the Projects collection: " + prjs.Parent.Name; msg += "
The GUID representing the Projects type: " + prjs.Kind; if (prjs.Properties != null) { msg += "
Properties:"; foreach (Property prop in prjs.Properties) { msg += "
" + prop.Name; } } MessageBox.Show(msg, "Projects Collection"); } catch(Exception ex) { MessageBox.Show(ex.Message); } }

Remarks

The value passed to index is an integer that is an index to a Project object in its collection. The value of index can alternatively be a string value that equates to the name of a project in the collection.

The Item method throws a ArgumentException exception if the collection cannot find the object that corresponds to the index value.

Applies to