CodeAttributeDeclarationCollection Class

Definition

Stellt eine Collection der CodeAttributeDeclaration-Objekte dar.Represents a collection of CodeAttributeDeclaration objects.

public ref class CodeAttributeDeclarationCollection : System::Collections::CollectionBase
public class CodeAttributeDeclarationCollection : System.Collections.CollectionBase
[System.Runtime.InteropServices.ComVisible(true)]
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Serializable]
public class CodeAttributeDeclarationCollection : System.Collections.CollectionBase
type CodeAttributeDeclarationCollection = class
    inherit CollectionBase
Public Class CodeAttributeDeclarationCollection
Inherits CollectionBase
Inheritance
CodeAttributeDeclarationCollection
Attributes

Examples

Das folgende Beispiel veranschaulicht die Verwendung der Methoden der CodeAttributeDeclarationCollection-Klasse.The following example demonstrates the use of the CodeAttributeDeclarationCollection class methods.

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

// Adds a CodeAttributeDeclaration to the collection.
array<CodeAttributeArgument^>^temp = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )};
collection->Add( gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp ) );

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

// Adds a collection of CodeAttributeDeclaration objects 
// to the collection.
CodeAttributeDeclarationCollection^ declarationsCollection = gcnew CodeAttributeDeclarationCollection;
array<CodeAttributeArgument^>^temp1 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )};
declarationsCollection->Add( gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp1 ) );
array<CodeAttributeArgument^>^temp2 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( true ) )};
declarationsCollection->Add( gcnew CodeAttributeDeclaration( "BrowsableAttribute",temp2 ) );
collection->AddRange( declarationsCollection );

// Tests for the presence of a CodeAttributeDeclaration in 
// the collection, and retrieves its index if it is found.
array<CodeAttributeArgument^>^temp3 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )};
CodeAttributeDeclaration^ testdeclaration = gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp3 );
int itemIndex = -1;
if ( collection->Contains( testdeclaration ) )
   itemIndex = collection->IndexOf( testdeclaration );

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

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

// Inserts a CodeAttributeDeclaration at index 0 of the collection.
array<CodeAttributeArgument^>^temp4 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )};
collection->Insert( 0, gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp4 ) );

// Removes the specified CodeAttributeDeclaration from 
// the collection.
array<CodeAttributeArgument^>^temp5 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )};
CodeAttributeDeclaration^ declaration = gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp5 );
collection->Remove( declaration );

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

// Adds a CodeAttributeDeclaration to the collection.
collection.Add( new CodeAttributeDeclaration("DescriptionAttribute",  new CodeAttributeArgument(new CodePrimitiveExpression("Test Description"))) );

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

// Adds a collection of CodeAttributeDeclaration objects
// to the collection.
CodeAttributeDeclarationCollection declarationsCollection = new CodeAttributeDeclarationCollection();
declarationsCollection.Add( new CodeAttributeDeclaration("DescriptionAttribute", new CodeAttributeArgument(new CodePrimitiveExpression("Test Description"))) );
declarationsCollection.Add( new CodeAttributeDeclaration("BrowsableAttribute", new CodeAttributeArgument(new CodePrimitiveExpression(true))) );
collection.AddRange( declarationsCollection );

// Tests for the presence of a CodeAttributeDeclaration in
// the collection, and retrieves its index if it is found.
CodeAttributeDeclaration testdeclaration = new CodeAttributeDeclaration("DescriptionAttribute", new CodeAttributeArgument(new CodePrimitiveExpression("Test Description")) );
int itemIndex = -1;
if( collection.Contains( testdeclaration ) )
    itemIndex = collection.IndexOf( testdeclaration );

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

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

// Inserts a CodeAttributeDeclaration at index 0 of the collection.
collection.Insert( 0, new CodeAttributeDeclaration("DescriptionAttribute", new CodeAttributeArgument(new CodePrimitiveExpression("Test Description"))) );

// Removes the specified CodeAttributeDeclaration from
// the collection.
CodeAttributeDeclaration declaration = new CodeAttributeDeclaration("DescriptionAttribute", new CodeAttributeArgument(new CodePrimitiveExpression("Test Description")) );
collection.Remove( declaration );

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

' Adds a CodeAttributeDeclaration to the collection.
collection.Add(New CodeAttributeDeclaration("DescriptionAttribute", New CodeAttributeArgument(New CodePrimitiveExpression("Test Description"))))

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

' Adds a collection of CodeAttributeDeclaration objects to 
' the collection.
Dim declarationsCollection As New CodeAttributeDeclarationCollection()
declarationsCollection.Add(New CodeAttributeDeclaration("DescriptionAttribute", New CodeAttributeArgument(New CodePrimitiveExpression("Test Description"))))
declarationsCollection.Add(New CodeAttributeDeclaration("BrowsableAttribute", New CodeAttributeArgument(New CodePrimitiveExpression(True))))
collection.AddRange(declarationsCollection)

' Tests for the presence of a CodeAttributeDeclaration in the 
' collection, and retrieves its index if it is found.
Dim testdeclaration As New CodeAttributeDeclaration("DescriptionAttribute", New CodeAttributeArgument(New CodePrimitiveExpression("Test Description")))
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 CodeAttributeDeclaration array.
' 'declarations' is a CodeAttributeDeclaration array.
collection.CopyTo(declarations, 0)

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

' Inserts a CodeAttributeDeclaration at index 0 of the collection.
collection.Insert(0, New CodeAttributeDeclaration("DescriptionAttribute", New CodeAttributeArgument(New CodePrimitiveExpression("Test Description"))))

' Removes the specified CodeAttributeDeclaration from the collection.
Dim declaration As New CodeAttributeDeclaration("DescriptionAttribute", New CodeAttributeArgument(New CodePrimitiveExpression("Test Description")))
collection.Remove(declaration)

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

Remarks

Die CodeAttributeDeclarationCollection-Klasse stellt ein einfaches Auflistungsobjekt bereit, mit dem ein Satz von CodeAttributeDeclaration-Objekten gespeichert werden kann.The CodeAttributeDeclarationCollection class provides a simple collection object that can be used to store a set of CodeAttributeDeclaration objects.

Constructors

CodeAttributeDeclarationCollection()

Initialisiert eine neue Instanz der CodeAttributeDeclarationCollection-Klasse.Initializes a new instance of the CodeAttributeDeclarationCollection class.

CodeAttributeDeclarationCollection(CodeAttributeDeclaration[])

Initialisiert eine neue Instanz der CodeAttributeDeclarationCollection-Klasse, die das angegebene Array von CodeAttributeDeclaration-Objekten enthält.Initializes a new instance of the CodeAttributeDeclarationCollection class containing the specified array of CodeAttributeDeclaration objects.

CodeAttributeDeclarationCollection(CodeAttributeDeclarationCollection)

Initialisiert eine neue Instanz der CodeAttributeDeclarationCollection-Klasse, die die Elemente der angegebenen Quellauflistung enthält.Initializes a new instance of the CodeAttributeDeclarationCollection class containing the elements of the specified source collection.

Properties

Capacity

Ruft die Anzahl der Elemente ab, die die CollectionBase enthalten kann, oder legt diese fest.Gets or sets the number of elements that the CollectionBase can contain.

(Inherited from CollectionBase)
Count

Ruft die Anzahl der in der CollectionBase-Instanz enthaltenen Elemente ab.Gets the number of elements contained in the CollectionBase instance. Diese Eigenschaft kann nicht überschrieben werden.This property cannot be overridden.

(Inherited from CollectionBase)
InnerList

Ruft eine ArrayList mit der Liste der Elemente in der CollectionBase-Instanz ab.Gets an ArrayList containing the list of elements in the CollectionBase instance.

(Inherited from CollectionBase)
Item[Int32]

Ruft das CodeAttributeDeclaration-Objekt am angegebenen Index ab oder legt dieses fest.Gets or sets the CodeAttributeDeclaration object at the specified index.

List

Ruft eine IList mit der Liste der Elemente in der CollectionBase-Instanz ab.Gets an IList containing the list of elements in the CollectionBase instance.

(Inherited from CollectionBase)

Methods

Add(CodeAttributeDeclaration)

Fügt der Auflistung ein CodeAttributeDeclaration-Objekt mit dem angegebenen Wert hinzu.Adds a CodeAttributeDeclaration object with the specified value to the collection.

AddRange(CodeAttributeDeclaration[])

Kopiert die Elemente des angegebenen CodeAttributeDeclaration-Arrays an das Ende der Auflistung.Copies the elements of the specified CodeAttributeDeclaration array to the end of the collection.

AddRange(CodeAttributeDeclarationCollection)

Kopiert den Inhalt eines anderen CodeAttributeDeclarationCollection-Objekts an das Ende der Auflistung.Copies the contents of another CodeAttributeDeclarationCollection object to the end of the collection.

Clear()

Entfernt alle Objekte aus der CollectionBase-Instanz.Removes all objects from the CollectionBase instance. Diese Methode kann nicht überschrieben werden.This method cannot be overridden.

(Inherited from CollectionBase)
Contains(CodeAttributeDeclaration)

Ruft einen Wert ab, der angibt, ob die Auflistung das angegebene CodeAttributeDeclaration-Objekt enthält, oder legt diesen fest.Gets or sets a value that indicates whether the collection contains the specified CodeAttributeDeclaration object.

CopyTo(CodeAttributeDeclaration[], Int32)

Kopiert die Auflistungsobjekte in eine eindimensionale Array-Instanz, beginnend am angegebenen Index.Copies the collection objects to a one-dimensional Array instance beginning at the specified index.

Equals(Object)

Bestimmt, ob das angegebene Objekt mit dem aktuellen Objekt identisch ist.Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator()

Gibt einen Enumerator zurück, der die CollectionBase durchläuft.Returns an enumerator that iterates through the CollectionBase instance.

(Inherited from CollectionBase)
GetHashCode()

Fungiert als Standardhashfunktion.Serves as the default hash function.

(Inherited from Object)
GetType()

Ruft den Type der aktuellen Instanz ab.Gets the Type of the current instance.

(Inherited from Object)
IndexOf(CodeAttributeDeclaration)

Ruft den Index des angegebenen CodeAttributeDeclaration-Objekts in der Auflistung ab, sofern es in der Auflistung vorhanden ist.Gets the index of the specified CodeAttributeDeclaration object in the collection, if it exists in the collection.

Insert(Int32, CodeAttributeDeclaration)

Fügt das angegebene CodeAttributeDeclaration-Objekt am angegebenen Index in die Auflistung ein.Inserts the specified CodeAttributeDeclaration object into the collection at the specified index.

MemberwiseClone()

Erstellt eine flache Kopie des aktuellen Object.Creates a shallow copy of the current Object.

(Inherited from Object)
OnClear()

Führt beim Löschen des Inhalts der CollectionBase-Instanz zusätzliche benutzerdefinierte Prozesse aus.Performs additional custom processes when clearing the contents of the CollectionBase instance.

(Inherited from CollectionBase)
OnClearComplete()

Führt nach dem Löschen des Inhalts der CollectionBase-Instanz zusätzliche benutzerdefinierte Prozesse aus.Performs additional custom processes after clearing the contents of the CollectionBase instance.

(Inherited from CollectionBase)
OnInsert(Int32, Object)

Führt zusätzliche benutzerdefinierte Prozesse vor dem Einfügen eines neuen Elements in die CollectionBase-Instanz aus.Performs additional custom processes before inserting a new element into the CollectionBase instance.

(Inherited from CollectionBase)
OnInsertComplete(Int32, Object)

Führt zusätzliche benutzerdefinierte Prozesse nach dem Einfügen eines neuen Elements in die CollectionBase-Instanz aus.Performs additional custom processes after inserting a new element into the CollectionBase instance.

(Inherited from CollectionBase)
OnRemove(Int32, Object)

Führt zusätzliche benutzerdefinierte Prozesse beim Entfernen eines Elements aus der CollectionBase-Instanz aus.Performs additional custom processes when removing an element from the CollectionBase instance.

(Inherited from CollectionBase)
OnRemoveComplete(Int32, Object)

Führt zusätzliche benutzerdefinierte Prozesse nach dem Entfernen eines Elements aus der CollectionBase-Instanz aus.Performs additional custom processes after removing an element from the CollectionBase instance.

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

Führt zusätzliche benutzerdefinierte Prozesse vor dem Festlegen eines Werts in der CollectionBase-Instanz aus.Performs additional custom processes before setting a value in the CollectionBase instance.

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

Führt zusätzliche benutzerdefinierte Prozesse nach dem Festlegen eines Werts in der CollectionBase-Instanz aus.Performs additional custom processes after setting a value in the CollectionBase instance.

(Inherited from CollectionBase)
OnValidate(Object)

Führt zusätzliche benutzerdefinierte Prozesse beim Validieren eines Werts aus.Performs additional custom processes when validating a value.

(Inherited from CollectionBase)
Remove(CodeAttributeDeclaration)

Entfernt das angegebene CodeAttributeDeclaration-Objekt aus der Auflistung.Removes the specified CodeAttributeDeclaration object from the collection.

RemoveAt(Int32)

Entfernt das Element am angegebenen Index aus der CollectionBase-Instanz.Removes the element at the specified index of the CollectionBase instance. Diese Methode kann nicht überschrieben werden.This method is not overridable.

(Inherited from CollectionBase)
ToString()

Gibt eine Zeichenfolge zurück, die das aktuelle Objekt darstellt.Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

ICollection.CopyTo(Array, Int32)

Kopiert die gesamte CollectionBase-Instanz in ein kompatibles eindimensionales Array, beginnend am angegebenen Index des Zielarrays.Copies the entire CollectionBase to a compatible one-dimensional Array, starting at the specified index of the target array.

(Inherited from CollectionBase)
ICollection.IsSynchronized

Ruft einen Wert ab, der angibt, ob der Zugriff auf CollectionBase synchronisiert (threadsicher) ist.Gets a value indicating whether access to the CollectionBase is synchronized (thread safe).

(Inherited from CollectionBase)
ICollection.SyncRoot

Ruft ein Objekt ab, mit dem der Zugriff auf CollectionBase synchronisiert werden kann.Gets an object that can be used to synchronize access to the CollectionBase.

(Inherited from CollectionBase)
IList.Add(Object)

Fügt ein Objekt am Ende von CollectionBase hinzu.Adds an object to the end of the CollectionBase.

(Inherited from CollectionBase)
IList.Contains(Object)

Ermittelt, ob CollectionBase ein bestimmtes Element enthält.Determines whether the CollectionBase contains a specific element.

(Inherited from CollectionBase)
IList.IndexOf(Object)

Sucht nach dem angegebenen Object und gibt den nullbasierten Index des ersten Vorkommens innerhalb der gesamten CollectionBase zurück.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)

Fügt ein Element am angegebenen Index in die CollectionBase ein.Inserts an element into the CollectionBase at the specified index.

(Inherited from CollectionBase)
IList.IsFixedSize

Ruft einen Wert ab, der angibt, ob CollectionBase eine feste Größe aufweist.Gets a value indicating whether the CollectionBase has a fixed size.

(Inherited from CollectionBase)
IList.IsReadOnly

Ruft einen Wert ab, der angibt, ob der CollectionBase schreibgeschützt ist.Gets a value indicating whether the CollectionBase is read-only.

(Inherited from CollectionBase)
IList.Item[Int32]

Ruft das Element am angegebenen Index ab oder legt es fest.Gets or sets the element at the specified index.

(Inherited from CollectionBase)
IList.Remove(Object)

Entfernt das erste Vorkommen eines bestimmten Objekts aus CollectionBase.Removes the first occurrence of a specific object from the CollectionBase.

(Inherited from CollectionBase)

Extension Methods

Cast<TResult>(IEnumerable)

Wandelt die Elemente eines IEnumerable in den angegebenen Typ umCasts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

Filtert die Elemente eines IEnumerable anhand eines angegebenen TypsFilters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

Ermöglicht die Parallelisierung einer Abfrage.Enables parallelization of a query.

AsQueryable(IEnumerable)

Konvertiert einen IEnumerable in einen IQueryable.Converts an IEnumerable to an IQueryable.

Applies to

See also