Solution3.Item(Object) Methode

Definition

Gibt einen indizierten Member einer Projects-Auflistung zurück.

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);
[<System.Runtime.InteropServices.DispId(0)>]
abstract member Item : obj -> EnvDTE.Project
Public Function Item (index As Object) As Project

Parameter

index
Object

Gibt zurück

Project

Ein Project-Objekt.

Implementiert

Attribute

Beispiele

Sub SolnItemExample(ByVal dte As DTE2)  
    ' Iterates through project items in a  solution.  
    ' Make sure you have a solution open in Visual Studio before running this example.  
    Try  
        Dim soln As Solution3 = _  
        CType(_applicationObject.Solution, Solution3)  
        ' Dim solnName As String = _  
         System.IO.Path.GetFileNameWithoutExtension(soln.FullName)  
        Dim tempString As String = "The items in the solution are: "  _  
        & vbCr  
        For i As Integer = 1 To soln.Projects.Count  
            tempString = tempString & soln.Item(i).Name.ToString()  _  
            & vbCr  
        Next  
        MsgBox(tempString)  
    Catch ex As System.Exception  
        MsgBox(ex.ToString)  
    End Try  
End Sub  
using System.Windows.Forms;  
public void SolnItemExample(DTE2 dte)  
{  
    // Iterates through the project items in a solution.  
    // Open a solution in Visual Studio before running this example.  
    try  
    {  
        Solution3 soln = (Solution3)_applicationObject.Solution;  
        String tempString = "The items in the solution are: " + "\n";  
        for (int i = 1; i <= soln.Projects.Count; i++)  
        {  
            tempString = tempString + soln.Item(i).Name.ToString()   
              + "\n";  
        }  
        MessageBox.Show(tempString);  
    }  
    catch (SystemException ex)  
    {  
        MessageBox.Show("ERROR: " + ex);  
    }  
}  

Hinweise

Der an über gegebene Wert Index ist eine Ganzzahl, bei der es sich um einen Index für ein Objekt in der Auflistung handelt. Der Wert von Index kann auch ein Zeichen folgen Wert sein, der einem Objekt in der Auflistung entspricht. Der genaue Wert, der von akzeptiert wird, hängt jedoch von Item der Auflistung und ihrer Implementierung ab.

Die- Item Methode löst eine-Ausnahme aus, wenn die Auflistung das- ArgumentException Objekt nicht finden kann, das dem Indexwert entspricht.

Gilt für