Metodo References.Item

Restituisce un oggetto Reference indicizzato.

Spazio dei nomi:  VSLangProj
Assembly:  VSLangProj (in VSLangProj.dll)

Sintassi

'Dichiarazione
Function Item ( _
    index As Object _
) As Reference
Reference Item(
    Object index
)
Reference^ Item(
    [InAttribute] Object^ index
)
abstract Item : 
        index:Object -> Reference 
function Item(
    index : Object
) : Reference

Parametri

Valore restituito

Tipo: VSLangProj.Reference
Restituisce un oggetto Reference.

Note

Questo metodo viene utilizzato per recuperare un oggetto specifico dall’insieme References. Non esiste alcuna garanzia che un dato numero di indice per un’insieme punti sempre allo stesso elemento, poiché è possibile aggiungere o eliminare elementi dall’insieme. È utile ricorrere ai numeri di indice per l’insieme quando si esegue un’iterazione all'interno dell'insieme e nessun elemento viene aggiunto o eliminato durante tale iterazione.

Esempi

' Macro Editor
Imports VSLangProj
Public Sub FindExample()
   ' First project is a Visual Basic or C# project.
   Dim theVSProject As VSProject = _
      CType(DTE.Solution.Projects.Item(1).Object, VSProject)
        
   Dim refs As References = theVSProject.References
   Dim firstIdentity As String = refs.Item(1).Identity
   Dim firstRef As Reference = refs.Find(firstIdentity)
   ' Are they the same object?
   Dim isSame As Boolean = (firstRef.Identity = refs.Item(1).Identity)
   MsgBox("Are they the same? " & isSame.ToString())
End Sub    

Sicurezza di .NET Framework

Vedere anche

Riferimenti

References Interfaccia

Spazio dei nomi VSLangProj