Metodo Properties.Item
Restituisce un membro indicizzato di un oggetto Properties raccolta.
Spazio dei nomi: EnvDTE
Assembly: EnvDTE (in EnvDTE.dll)
Sintassi
'Dichiarazione
Function Item ( _
index As Object _
) As Property
Property Item(
Object index
)
Property^ Item(
[InAttribute] Object^ index
)
abstract Item :
index:Object -> Property
function Item(
index : Object
) : Property
Parametri
- index
Tipo: System.Object
obbligatorio.L'indice di Property oggetto da restituire.
Valore restituito
Tipo: EnvDTE.Property
In Property oggetto.
Note
il valore passato a Index è un valore di indice a un oggetto Property oggetto in Properties raccolta o il nome di in Property oggetto nella raccolta.
Item il metodo genera un'eccezione ArgumentException eccezione se il valore specificato non è disponibile nella raccolta.
Esempi
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);
}
}
Sicurezza di .NET Framework
- Attendibilità totale per il chiamante immediato. Impossibile utilizzare questo membro in codice parzialmente attendibile. Per ulteriori informazioni, vedere Utilizzo di librerie da codice parzialmente attendibile.
Vedere anche
Riferimenti
Altre risorse
Procedura: compilare ed eseguire gli esempi di codice del modello a oggetti di automazione