CodeNamespaceCollection Klasse
Definition
Stellt eine Auflistung von CodeNamespace-Objekten dar.Represents a collection of CodeNamespace objects.
public ref class CodeNamespaceCollection : System::Collections::CollectionBase
public class CodeNamespaceCollection : System.Collections.CollectionBase
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeNamespaceCollection : System.Collections.CollectionBase
type CodeNamespaceCollection = class
inherit CollectionBase
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeNamespaceCollection = class
inherit CollectionBase
Public Class CodeNamespaceCollection
Inherits CollectionBase
- Vererbung
- Attribute
Beispiele
Im folgenden Beispiel wird die Verwendung der CodeNamespaceCollection-Klasse veranschaulicht.The following example demonstrates how to use the CodeNamespaceCollection class. Im Beispiel wird eine neue Instanz der-Klasse erstellt, und es werden mehrere Methoden zum Hinzufügen von-Anweisungen zur Auflistung, zum Zurückgeben des Indexes und zum Hinzufügen oder Entfernen von Attributen an einem bestimmten Index Punkt verwendet.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 CodeNamespaceCollection.
CodeNamespaceCollection^ collection = gcnew CodeNamespaceCollection;
// Adds a CodeNamespace to the collection.
collection->Add( gcnew CodeNamespace( "TestNamespace" ) );
// Adds an array of CodeNamespace objects to the collection.
array<CodeNamespace^>^namespaces = {gcnew CodeNamespace( "TestNamespace1" ),gcnew CodeNamespace( "TestNamespace2" )};
collection->AddRange( namespaces );
// Adds a collection of CodeNamespace objects to the collection.
CodeNamespaceCollection^ namespacesCollection = gcnew CodeNamespaceCollection;
namespacesCollection->Add( gcnew CodeNamespace( "TestNamespace1" ) );
namespacesCollection->Add( gcnew CodeNamespace( "TestNamespace2" ) );
collection->AddRange( namespacesCollection );
// Tests for the presence of a CodeNamespace in the collection,
// and retrieves its index if it is found.
CodeNamespace^ testNamespace = gcnew CodeNamespace( "TestNamespace" );
int itemIndex = -1;
if ( collection->Contains( testNamespace ) )
itemIndex = collection->IndexOf( testNamespace );
// Copies the contents of the collection beginning at index 0,
// to the specified CodeNamespace array.
// 'namespaces' is a CodeNamespace array.
collection->CopyTo( namespaces, 0 );
// Retrieves the count of the items in the collection.
int collectionCount = collection->Count;
// Inserts a CodeNamespace at index 0 of the collection.
collection->Insert( 0, gcnew CodeNamespace( "TestNamespace" ) );
// Removes the specified CodeNamespace from the collection.
CodeNamespace^ namespace_ = gcnew CodeNamespace( "TestNamespace" );
collection->Remove( namespace_ );
// Removes the CodeNamespace at index 0.
collection->RemoveAt( 0 );
// Creates an empty CodeNamespaceCollection.
CodeNamespaceCollection collection = new CodeNamespaceCollection();
// Adds a CodeNamespace to the collection.
collection.Add( new CodeNamespace("TestNamespace") );
// Adds an array of CodeNamespace objects to the collection.
CodeNamespace[] namespaces = { new CodeNamespace("TestNamespace1"), new CodeNamespace("TestNamespace2") };
collection.AddRange( namespaces );
// Adds a collection of CodeNamespace objects to the collection.
CodeNamespaceCollection namespacesCollection = new CodeNamespaceCollection();
namespacesCollection.Add( new CodeNamespace("TestNamespace1") );
namespacesCollection.Add( new CodeNamespace("TestNamespace2") );
collection.AddRange( namespacesCollection );
// Tests for the presence of a CodeNamespace in the collection,
// and retrieves its index if it is found.
CodeNamespace testNamespace = new CodeNamespace("TestNamespace");
int itemIndex = -1;
if( collection.Contains( testNamespace ) )
itemIndex = collection.IndexOf( testNamespace );
// Copies the contents of the collection beginning at index 0,
// to the specified CodeNamespace array.
// 'namespaces' is a CodeNamespace array.
collection.CopyTo( namespaces, 0 );
// Retrieves the count of the items in the collection.
int collectionCount = collection.Count;
// Inserts a CodeNamespace at index 0 of the collection.
collection.Insert( 0, new CodeNamespace("TestNamespace") );
// Removes the specified CodeNamespace from the collection.
CodeNamespace namespace_ = new CodeNamespace("TestNamespace");
collection.Remove( namespace_ );
// Removes the CodeNamespace at index 0.
collection.RemoveAt(0);
' Creates an empty CodeNamespaceCollection.
Dim collection As New CodeNamespaceCollection()
' Adds a CodeNamespace to the collection.
collection.Add(New CodeNamespace("TestNamespace"))
' Adds an array of CodeNamespace objects to the collection.
Dim namespaces As CodeNamespace() = {New CodeNamespace("TestNamespace1"), New CodeNamespace("TestNamespace2")}
collection.AddRange(namespaces)
' Adds a collection of CodeNamespace objects to the collection.
Dim namespacesCollection As New CodeNamespaceCollection()
namespacesCollection.Add(New CodeNamespace("TestNamespace1"))
namespacesCollection.Add(New CodeNamespace("TestNamespace2"))
collection.AddRange(namespacesCollection)
' Tests for the presence of a CodeNamespace in the collection,
' and retrieves its index if it is found.
Dim testNamespace As New CodeNamespace("TestNamespace")
Dim itemIndex As Integer = -1
If collection.Contains(testNamespace) Then
itemIndex = collection.IndexOf(testNamespace)
End If
' Copies the contents of the collection beginning at index 0,
' to the specified CodeNamespace array.
' 'namespaces' is a CodeNamespace array.
collection.CopyTo(namespaces, 0)
' Retrieves the count of the items in the collection.
Dim collectionCount As Integer = collection.Count
' Inserts a CodeNamespace at index 0 of the collection.
collection.Insert(0, New CodeNamespace("TestNamespace"))
' Removes the specified CodeNamespace from the collection.
Dim namespace_ As New CodeNamespace("TestNamespace")
collection.Remove(namespace_)
' Removes the CodeNamespace at index 0.
collection.RemoveAt(0)
Hinweise
Die CodeNamespaceCollection-Klasse stellt ein einfaches Auflistungsobjekt bereit, mit dem ein Satz von CodeNamespace-Objekten gespeichert werden kann.The CodeNamespaceCollection class provides a simple collection object that can be used to store a set of CodeNamespace objects.
Konstruktoren
CodeNamespaceCollection() |
Initialisiert eine neue Instanz der CodeNamespaceCollection-Klasse.Initializes a new instance of the CodeNamespaceCollection class. |
CodeNamespaceCollection(CodeNamespace[]) |
Initialisiert eine neue Instanz der CodeNamespaceCollection-Klasse, die das angegebene Array von CodeNamespace-Objekten enthält.Initializes a new instance of the CodeNamespaceCollection class that contains the specified array of CodeNamespace objects. |
CodeNamespaceCollection(CodeNamespaceCollection) |
Initialisiert eine neue Instanz der CodeNamespaceCollection-Klasse, die die Elemente der angegebenen Quellauflistung enthält.Initializes a new instance of the CodeNamespaceCollection class that contains the elements of the specified source collection. |
Eigenschaften
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. (Geerbt von 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. (Geerbt von 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. (Geerbt von CollectionBase) |
Item[Int32] |
Ruft das CodeNamespaceCollection-Objekt am angegebenen Index in der Auflistung ab oder legt dieses fest.Gets or sets the CodeNamespaceCollection object at the specified index in the collection. |
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. (Geerbt von CollectionBase) |
Methoden
Add(CodeNamespace) |
Fügt der Auflistung das angegebene CodeNamespace-Objekt hinzu.Adds the specified CodeNamespace object to the collection. |
AddRange(CodeNamespace[]) |
Kopiert die Elemente des angegebenen CodeNamespace-Arrays an das Ende der Auflistung.Copies the elements of the specified CodeNamespace array to the end of the collection. |
AddRange(CodeNamespaceCollection) |
Fügt den Inhalt des angegebenen CodeNamespaceCollection-Objekts am Ende der Auflistung hinzu.Adds the contents of the specified CodeNamespaceCollection 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. (Geerbt von CollectionBase) |
Contains(CodeNamespace) |
Ruft einen Wert ab, der angibt, ob die Auflistung das angegebene CodeNamespace-Objekt enthält.Gets a value that indicates whether the collection contains the specified CodeNamespace object. |
CopyTo(CodeNamespace[], Int32) |
Kopiert die Auflistungsobjekte in eine eindimensionale Array-Instanz, beginnend am angegebenen Index.Copies the collection objects to a one-dimensional Array instance, starting 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. (Geerbt von Object) |
GetEnumerator() |
Gibt einen Enumerator zurück, der die CollectionBase durchläuft.Returns an enumerator that iterates through the CollectionBase instance. (Geerbt von CollectionBase) |
GetHashCode() |
Fungiert als Standardhashfunktion.Serves as the default hash function. (Geerbt von Object) |
GetType() |
Ruft den Type der aktuellen Instanz ab.Gets the Type of the current instance. (Geerbt von Object) |
IndexOf(CodeNamespace) |
Ruft den Index des angegebenen CodeNamespace-Objekts in der CodeNamespaceCollection ab, sofern dieses in der Auflistung vorhanden ist.Gets the index of the specified CodeNamespace object in the CodeNamespaceCollection, if it exists in the collection. |
Insert(Int32, CodeNamespace) |
Fügt das angegebene CodeNamespace-Objekt am angegebenen Index in die Auflistung ein.Inserts the specified CodeNamespace object into the collection at the specified index. |
MemberwiseClone() |
Erstellt eine flache Kopie des aktuellen Object.Creates a shallow copy of the current Object. (Geerbt von 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. (Geerbt von 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. (Geerbt von 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. (Geerbt von 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. (Geerbt von 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. (Geerbt von 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. (Geerbt von 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. (Geerbt von 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. (Geerbt von CollectionBase) |
OnValidate(Object) |
Führt zusätzliche benutzerdefinierte Prozesse beim Validieren eines Werts aus.Performs additional custom processes when validating a value. (Geerbt von CollectionBase) |
Remove(CodeNamespace) |
Entfernt das angegebene CodeNamespace-Objekt aus der Auflistung.Removes the specified CodeNamespace 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. (Geerbt von CollectionBase) |
ToString() |
Gibt eine Zeichenfolge zurück, die das aktuelle Objekt darstellt.Returns a string that represents the current object. (Geerbt von Object) |
Explizite Schnittstellenimplementierungen
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. (Geerbt von CollectionBase) |
ICollection.IsSynchronized |
Ruft einen Wert ab, der angibt, ob der Zugriff auf die CollectionBase synchronisiert (threadsicher) ist.Gets a value indicating whether access to the CollectionBase is synchronized (thread safe). (Geerbt von 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. (Geerbt von CollectionBase) |
IList.Add(Object) |
Fügt am Ende der CollectionBase ein Objekt hinzu.Adds an object to the end of the CollectionBase. (Geerbt von CollectionBase) |
IList.Contains(Object) |
Ermittelt, ob CollectionBase ein bestimmtes Element enthält.Determines whether the CollectionBase contains a specific element. (Geerbt von 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. (Geerbt von CollectionBase) |
IList.Insert(Int32, Object) |
Fügt am angegebenen Index ein Element in die CollectionBase ein.Inserts an element into the CollectionBase at the specified index. (Geerbt von CollectionBase) |
IList.IsFixedSize |
Ruft einen Wert ab, der angibt, ob das CollectionBase eine feste Größe aufweist.Gets a value indicating whether the CollectionBase has a fixed size. (Geerbt von CollectionBase) |
IList.IsReadOnly |
Ruft einen Wert ab, der angibt, ob das CollectionBase schreibgeschützt ist.Gets a value indicating whether the CollectionBase is read-only. (Geerbt von CollectionBase) |
IList.Item[Int32] |
Ruft das Element am angegebenen Index ab oder legt dieses fest.Gets or sets the element at the specified index. (Geerbt von CollectionBase) |
IList.Remove(Object) |
Entfernt das erste Vorkommen eines angegebenen Objekts aus der CollectionBase.Removes the first occurrence of a specific object from the CollectionBase. (Geerbt von CollectionBase) |
Erweiterungsmethoden
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. |