CodeTypeDeclarationCollection CodeTypeDeclarationCollection CodeTypeDeclarationCollection CodeTypeDeclarationCollection Class

Definizione

Rappresenta una raccolta di oggetti CodeTypeDeclaration.Represents a collection of CodeTypeDeclaration objects.

public ref class CodeTypeDeclarationCollection : System::Collections::CollectionBase
[System.Runtime.InteropServices.ComVisible(true)]
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Serializable]
public class CodeTypeDeclarationCollection : System.Collections.CollectionBase
type CodeTypeDeclarationCollection = class
    inherit CollectionBase
Public Class CodeTypeDeclarationCollection
Inherits CollectionBase
Ereditarietà
CodeTypeDeclarationCollectionCodeTypeDeclarationCollectionCodeTypeDeclarationCollectionCodeTypeDeclarationCollection
Attributi

Esempi

Nell'esempio riportato di seguito viene illustrato come utilizzare la classe CodeTypeDeclarationCollection.The following example demonstrates how to use the CodeTypeDeclarationCollection class. L'esempio crea una nuova istanza della classe e Usa diversi metodi per aggiungere le istruzioni per la raccolta, restituire il relativo indice e aggiungere o rimuovere gli attributi in un determinato indice specifico.The example creates a new instance of the class and uses several methods to add statements to the collection, return their index, and add or remove attributes at a specific index point.

// Creates an empty CodeTypeDeclarationCollection.
CodeTypeDeclarationCollection^ collection = gcnew CodeTypeDeclarationCollection;

// Adds a CodeTypeDeclaration to the collection.
collection->Add( gcnew CodeTypeDeclaration( "TestType" ) );

// Adds an array of CodeTypeDeclaration objects to the collection.
array<CodeTypeDeclaration^>^declarations = {gcnew CodeTypeDeclaration( "TestType1" ),gcnew CodeTypeDeclaration( "TestType2" )};
collection->AddRange( declarations );

// Adds a collection of CodeTypeDeclaration objects to the 
// collection.
CodeTypeDeclarationCollection^ declarationsCollection = gcnew CodeTypeDeclarationCollection;
declarationsCollection->Add( gcnew CodeTypeDeclaration( "TestType1" ) );
declarationsCollection->Add( gcnew CodeTypeDeclaration( "TestType2" ) );
collection->AddRange( declarationsCollection );

// Tests for the presence of a CodeTypeDeclaration in the 
// collection, and retrieves its index if it is found.
CodeTypeDeclaration^ testDeclaration = gcnew CodeTypeDeclaration( "TestType" );
int itemIndex = -1;
if ( collection->Contains( testDeclaration ) )
   itemIndex = collection->IndexOf( testDeclaration );

// Copies the contents of the collection, beginning at index 0,
// to the specified CodeTypeDeclaration array.
// 'declarations' is a CodeTypeDeclaration array.
collection->CopyTo( declarations, 0 );

// Retrieves the count of the items in the collection.
int collectionCount = collection->Count;

// Inserts a CodeTypeDeclaration at index 0 of the collection.
collection->Insert( 0, gcnew CodeTypeDeclaration( "TestType" ) );

// Removes the specified CodeTypeDeclaration from the collection.
CodeTypeDeclaration^ declaration = gcnew CodeTypeDeclaration( "TestType" );
collection->Remove( declaration );

// Removes the CodeTypeDeclaration at index 0.
collection->RemoveAt( 0 );
// Creates an empty CodeTypeDeclarationCollection.
CodeTypeDeclarationCollection collection = new CodeTypeDeclarationCollection();

// Adds a CodeTypeDeclaration to the collection.
collection.Add( new CodeTypeDeclaration("TestType") );

// Adds an array of CodeTypeDeclaration objects to the collection.
CodeTypeDeclaration[] declarations = { new CodeTypeDeclaration("TestType1"), new CodeTypeDeclaration("TestType2") };
collection.AddRange( declarations );

// Adds a collection of CodeTypeDeclaration objects to the 
// collection.
CodeTypeDeclarationCollection declarationsCollection = new CodeTypeDeclarationCollection();
declarationsCollection.Add( new CodeTypeDeclaration("TestType1") );
declarationsCollection.Add( new CodeTypeDeclaration("TestType2") );
collection.AddRange( declarationsCollection );

// Tests for the presence of a CodeTypeDeclaration in the 
// collection, and retrieves its index if it is found.
CodeTypeDeclaration testDeclaration = new CodeTypeDeclaration("TestType");
int itemIndex = -1;
if( collection.Contains( testDeclaration ) )
    itemIndex = collection.IndexOf( testDeclaration );

// Copies the contents of the collection, beginning at index 0,
// to the specified CodeTypeDeclaration array.
// 'declarations' is a CodeTypeDeclaration array.
collection.CopyTo( declarations, 0 );

// Retrieves the count of the items in the collection.
int collectionCount = collection.Count;

// Inserts a CodeTypeDeclaration at index 0 of the collection.
collection.Insert( 0, new CodeTypeDeclaration("TestType") );

// Removes the specified CodeTypeDeclaration from the collection.
CodeTypeDeclaration declaration = new CodeTypeDeclaration("TestType");
collection.Remove( declaration );

// Removes the CodeTypeDeclaration at index 0.
collection.RemoveAt(0);
' Creates an empty CodeTypeDeclarationCollection.
Dim collection As New CodeTypeDeclarationCollection()

' Adds a CodeTypeDeclaration to the collection.
collection.Add(New CodeTypeDeclaration("TestType"))

' Adds an array of CodeTypeDeclaration objects to the 
' collection.
Dim declarations As CodeTypeDeclaration() = {New CodeTypeDeclaration("TestType1"), New CodeTypeDeclaration("TestType2")}
collection.AddRange(declarations)

' Adds a collection of CodeTypeDeclaration objects to the collection.
Dim declarationsCollection As New CodeTypeDeclarationCollection()
declarationsCollection.Add(New CodeTypeDeclaration("TestType1"))
declarationsCollection.Add(New CodeTypeDeclaration("TestType2"))
collection.AddRange(declarationsCollection)

' Tests for the presence of a CodeTypeDeclaration in the 
' collection, and retrieves its index if it is found.
Dim testDeclaration As New CodeTypeDeclaration("TestType")
Dim itemIndex As Integer = -1
If collection.Contains(testDeclaration) Then
    itemIndex = collection.IndexOf(testDeclaration)
End If

' Copies the contents of the collection, beginning at index 0,
' to the specified CodeTypeDeclaration array.
' 'declarations' is a CodeTypeDeclaration array.
collection.CopyTo(declarations, 0)

' Retrieves the count of the items in the collection.
Dim collectionCount As Integer = collection.Count

' Inserts a CodeTypeDeclaration at index 0 of the collection.
collection.Insert(0, New CodeTypeDeclaration("TestType"))

' Removes the specified CodeTypeDeclaration from the collection.
Dim declaration As New CodeTypeDeclaration("TestType")
collection.Remove(declaration)

' Removes the CodeTypeDeclaration at index 0.
collection.RemoveAt(0)

Commenti

La classe CodeTypeDeclarationCollection specifica un oggetto della raccolta che può essere utilizzato per archiviare un set di oggetti CodeTypeDeclaration.The CodeTypeDeclarationCollection class provides a simple collection object that can be used to store a set of CodeTypeDeclaration objects.

Costruttori

CodeTypeDeclarationCollection() CodeTypeDeclarationCollection() CodeTypeDeclarationCollection() CodeTypeDeclarationCollection()

Inizializza una nuova istanza della classe CodeTypeDeclarationCollection.Initializes a new instance of the CodeTypeDeclarationCollection class.

CodeTypeDeclarationCollection(CodeTypeDeclarationCollection) CodeTypeDeclarationCollection(CodeTypeDeclarationCollection) CodeTypeDeclarationCollection(CodeTypeDeclarationCollection) CodeTypeDeclarationCollection(CodeTypeDeclarationCollection)

Inizializza una nuova istanza della classe CodeTypeDeclarationCollection contenente gli elementi dell'insieme di origine specificato.Initializes a new instance of the CodeTypeDeclarationCollection class that contains the elements of the specified source collection.

CodeTypeDeclarationCollection(CodeTypeDeclaration[]) CodeTypeDeclarationCollection(CodeTypeDeclaration[]) CodeTypeDeclarationCollection(CodeTypeDeclaration[]) CodeTypeDeclarationCollection(CodeTypeDeclaration[])

Consente l'inizializzazione di una nuova istanza della classe CodeTypeDeclarationCollection contenente la matrice specificata di oggetti CodeTypeDeclaration.Initializes a new instance of the CodeTypeDeclarationCollection class that contains the specified array of CodeTypeDeclaration objects.

Proprietà

Capacity Capacity Capacity Capacity

Ottiene o imposta il numero di elementi che CollectionBase può contenere.Gets or sets the number of elements that the CollectionBase can contain.

(Inherited from CollectionBase)
Count Count Count Count

Ottiene il numero di elementi contenuti nell'istanza di CollectionBase.Gets the number of elements contained in the CollectionBase instance. Questa proprietà non può essere sottoposta a override.This property cannot be overridden.

(Inherited from CollectionBase)
ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized

Ottiene un valore che indica se l'accesso a CollectionBase è sincronizzato (thread-safe).Gets a value indicating whether access to the CollectionBase is synchronized (thread safe).

(Inherited from CollectionBase)
ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot

Ottiene un oggetto che può essere usato per sincronizzare l'accesso a CollectionBase.Gets an object that can be used to synchronize access to the CollectionBase.

(Inherited from CollectionBase)
IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize

Ottiene un valore che indica se CollectionBase ha dimensioni fisse.Gets a value indicating whether the CollectionBase has a fixed size.

(Inherited from CollectionBase)
IList.IsReadOnly IList.IsReadOnly IList.IsReadOnly IList.IsReadOnly

Ottiene un valore che indica se CollectionBase è di sola lettura.Gets a value indicating whether the CollectionBase is read-only.

(Inherited from CollectionBase)
IList.Item[Int32] IList.Item[Int32] IList.Item[Int32] IList.Item[Int32]

Ottiene o imposta l'elemento in corrispondenza dell'indice specificato.Gets or sets the element at the specified index.

(Inherited from CollectionBase)
InnerList InnerList InnerList InnerList

Ottiene un ArrayList contenente l'elenco degli elementi presenti nell'istanza CollectionBase.Gets an ArrayList containing the list of elements in the CollectionBase instance.

(Inherited from CollectionBase)
Item[Int32] Item[Int32] Item[Int32] Item[Int32]

Ottiene o imposta l'oggetto CodeTypeDeclaration nella raccolta, in corrispondenza dell'indice specificato.Gets or sets the CodeTypeDeclaration object at the specified index in the collection.

List List List List

Ottiene un IList contenente l'elenco degli elementi presenti nell'istanza CollectionBase.Gets an IList containing the list of elements in the CollectionBase instance.

(Inherited from CollectionBase)

Metodi

Add(CodeTypeDeclaration) Add(CodeTypeDeclaration) Add(CodeTypeDeclaration) Add(CodeTypeDeclaration)

Aggiunge l'oggetto CodeTypeDeclaration specificato alla raccolta.Adds the specified CodeTypeDeclaration object to the collection.

AddRange(CodeTypeDeclarationCollection) AddRange(CodeTypeDeclarationCollection) AddRange(CodeTypeDeclarationCollection) AddRange(CodeTypeDeclarationCollection)

Aggiunge il contenuto di un altro oggetto CodeTypeDeclarationCollection alla fine dell'insieme.Adds the contents of another CodeTypeDeclarationCollection object to the end of the collection.

AddRange(CodeTypeDeclaration[]) AddRange(CodeTypeDeclaration[]) AddRange(CodeTypeDeclaration[]) AddRange(CodeTypeDeclaration[])

Consente di copiare gli elementi della matrice specificata alla fine della raccolta.Copies the elements of the specified array to the end of the collection.

Clear() Clear() Clear() Clear()

Consente di rimuovere tutti gli oggetti dall'istanza CollectionBase.Removes all objects from the CollectionBase instance. Questo metodo non può essere sottoposto a override.This method cannot be overridden.

(Inherited from CollectionBase)
Contains(CodeTypeDeclaration) Contains(CodeTypeDeclaration) Contains(CodeTypeDeclaration) Contains(CodeTypeDeclaration)

Ottiene un valore che indica se l'insieme contiene l'oggetto CodeTypeDeclaration specificato.Gets a value that indicates whether the collection contains the specified CodeTypeDeclaration object.

CopyTo(CodeTypeDeclaration[], Int32) CopyTo(CodeTypeDeclaration[], Int32) CopyTo(CodeTypeDeclaration[], Int32) CopyTo(CodeTypeDeclaration[], Int32)

Copia gli elementi dell'oggetto CodeTypeDeclarationCollection in un'istanza di Array unidimensionale, a partire dall'indice specificato.Copies the elements in the CodeTypeDeclarationCollection object to a one-dimensional Array instance, starting at the specified index.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determina se l'oggetto specificato è uguale all'oggetto corrente.Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

Restituisce un enumeratore per lo scorrimento dell'istanza di CollectionBase.Returns an enumerator that iterates through the CollectionBase instance.

(Inherited from CollectionBase)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Funge da funzione hash predefinita.Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Ottiene l'oggetto Type dell'istanza corrente.Gets the Type of the current instance.

(Inherited from Object)
IndexOf(CodeTypeDeclaration) IndexOf(CodeTypeDeclaration) IndexOf(CodeTypeDeclaration) IndexOf(CodeTypeDeclaration)

Ottiene l'indice dell'oggetto CodeTypeDeclaration specificato in CodeTypeDeclarationCollection, se esistente.Gets the index of the specified CodeTypeDeclaration object in the CodeTypeDeclarationCollection, if it exists in the collection.

Insert(Int32, CodeTypeDeclaration) Insert(Int32, CodeTypeDeclaration) Insert(Int32, CodeTypeDeclaration) Insert(Int32, CodeTypeDeclaration)

Inserisce l'oggetto CodeTypeDeclaration specificato nella raccolta in corrispondenza dell'indice specificato.Inserts the specified CodeTypeDeclaration object into the collection at the specified index.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Crea una copia superficiale dell'oggetto Object corrente.Creates a shallow copy of the current Object.

(Inherited from Object)
OnClear() OnClear() OnClear() OnClear()

Consente di eseguire procedure personalizzate aggiuntive durante l'eliminazione del contenuto dell'istanza CollectionBase.Performs additional custom processes when clearing the contents of the CollectionBase instance.

(Inherited from CollectionBase)
OnClearComplete() OnClearComplete() OnClearComplete() OnClearComplete()

Consente di eseguire procedure personalizzate aggiuntive prima di cancellare il contenuto dell'istanza CollectionBase.Performs additional custom processes after clearing the contents of the CollectionBase instance.

(Inherited from CollectionBase)
OnInsert(Int32, Object) OnInsert(Int32, Object) OnInsert(Int32, Object) OnInsert(Int32, Object)

Consente di eseguire procedure personalizzate aggiuntive prima di inserire un nuovo elemento nell'istanza CollectionBase.Performs additional custom processes before inserting a new element into the CollectionBase instance.

(Inherited from CollectionBase)
OnInsertComplete(Int32, Object) OnInsertComplete(Int32, Object) OnInsertComplete(Int32, Object) OnInsertComplete(Int32, Object)

Consente di eseguire procedure personalizzate aggiuntive dopo aver inserito un nuovo elemento nell'istanza CollectionBase.Performs additional custom processes after inserting a new element into the CollectionBase instance.

(Inherited from CollectionBase)
OnRemove(Int32, Object) OnRemove(Int32, Object) OnRemove(Int32, Object) OnRemove(Int32, Object)

Consente di eseguire procedure personalizzate aggiuntive durante l'eliminazione di un elemento dall'istanza CollectionBase.Performs additional custom processes when removing an element from the CollectionBase instance.

(Inherited from CollectionBase)
OnRemoveComplete(Int32, Object) OnRemoveComplete(Int32, Object) OnRemoveComplete(Int32, Object) OnRemoveComplete(Int32, Object)

Consente di eseguire procedure personalizzate aggiuntive dopo della rimozione di un elemento dall'istanza CollectionBase.Performs additional custom processes after removing an element from the CollectionBase instance.

(Inherited from CollectionBase)
OnSet(Int32, Object, Object) OnSet(Int32, Object, Object) OnSet(Int32, Object, Object) OnSet(Int32, Object, Object)

Consente di eseguire procedure personalizzate aggiuntive prima di impostare un valore nell'istanza CollectionBase.Performs additional custom processes before setting a value in the CollectionBase instance.

(Inherited from CollectionBase)
OnSetComplete(Int32, Object, Object) OnSetComplete(Int32, Object, Object) OnSetComplete(Int32, Object, Object) OnSetComplete(Int32, Object, Object)

Consente di eseguire procedure personalizzate aggiuntive dopo aver impostato un valore nell'istanza CollectionBase.Performs additional custom processes after setting a value in the CollectionBase instance.

(Inherited from CollectionBase)
OnValidate(Object) OnValidate(Object) OnValidate(Object) OnValidate(Object)

Esegue processi personalizzati aggiuntivi durante la convalida di un valore.Performs additional custom processes when validating a value.

(Inherited from CollectionBase)
Remove(CodeTypeDeclaration) Remove(CodeTypeDeclaration) Remove(CodeTypeDeclaration) Remove(CodeTypeDeclaration)

Rimuove l'oggetto CodeTypeDeclaration specificato dalla raccolta.Removes the specified CodeTypeDeclaration object from the collection.

RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

Consente di rimuovere la voce in corrispondenza dell'indice specificato dell'istanza CollectionBase.Removes the element at the specified index of the CollectionBase instance. Questo metodo non può essere sottoposto a override.This method is not overridable.

(Inherited from CollectionBase)
ToString() ToString() ToString() ToString()

Restituisce una stringa che rappresenta l'oggetto corrente.Returns a string that represents the current object.

(Inherited from Object)

Implementazioni dell'interfaccia esplicita

ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32)

Copia l'intero oggetto CollectionBase in un oggetto Array compatibile unidimensionale, a partire dall'indice specificato della matrice di destinazione.Copies the entire CollectionBase to a compatible one-dimensional Array, starting at the specified index of the target array.

(Inherited from CollectionBase)
IList.Add(Object) IList.Add(Object) IList.Add(Object) IList.Add(Object)

Aggiunge un oggetto alla fine di CollectionBase.Adds an object to the end of the CollectionBase.

(Inherited from CollectionBase)
IList.Contains(Object) IList.Contains(Object) IList.Contains(Object) IList.Contains(Object)

Consente di stabilire se CollectionBase contiene un elemento specifico.Determines whether the CollectionBase contains a specific element.

(Inherited from CollectionBase)
IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object)

Cerca l'oggetto Object specificato e restituisce l'indice in base zero della prima occorrenza all'interno dell'intero CollectionBase.Searches for the specified Object and returns the zero-based index of the first occurrence within the entire CollectionBase.

(Inherited from CollectionBase)
IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object)

Inserisce un elemento in CollectionBase in corrispondenza dell'indice specificato.Inserts an element into the CollectionBase at the specified index.

(Inherited from CollectionBase)
IList.Remove(Object) IList.Remove(Object) IList.Remove(Object) IList.Remove(Object)

Rimuove la prima occorrenza di un oggetto specifico da CollectionBase.Removes the first occurrence of a specific object from the CollectionBase.

(Inherited from CollectionBase)

Metodi di estensione

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

Esegue il cast degli elementi di un oggetto IEnumerable nel tipo specificato.Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

Filtra gli elementi di un oggetto IEnumerable in base a un tipo specificato.Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

Consente la parallelizzazione di una query.Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

Converte un oggetto IEnumerable in un oggetto IQueryable.Converts an IEnumerable to an IQueryable.

Si applica a

Vedi anche