CodeCommentStatementCollection Classe

Définition

Représente une collection d'objets CodeCommentStatement.

public ref class CodeCommentStatementCollection : System::Collections::CollectionBase
public class CodeCommentStatementCollection : System.Collections.CollectionBase
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeCommentStatementCollection : System.Collections.CollectionBase
type CodeCommentStatementCollection = class
    inherit CollectionBase
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeCommentStatementCollection = class
    inherit CollectionBase
Public Class CodeCommentStatementCollection
Inherits CollectionBase
Héritage
CodeCommentStatementCollection
Attributs

Exemples

L’exemple suivant illustre l’utilisation des méthodes de CodeCommentStatementCollection classe. L’exemple crée une instance de la classe et utilise les méthodes pour ajouter des instructions à la collection, retourner leur index et ajouter ou supprimer des attributs à un point d’index spécifique.

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

// Adds a CodeCommentStatement to the collection.
collection->Add( gcnew CodeCommentStatement( "Test comment" ) );

// Adds an array of CodeCommentStatement objects to the collection.
array<CodeCommentStatement^>^comments = {gcnew CodeCommentStatement( "Test comment" ),gcnew CodeCommentStatement( "Another test comment" )};
collection->AddRange( comments );

// Adds a collection of CodeCommentStatement objects to the collection.
CodeCommentStatementCollection^ commentsCollection = gcnew CodeCommentStatementCollection;
commentsCollection->Add( gcnew CodeCommentStatement( "Test comment" ) );
commentsCollection->Add( gcnew CodeCommentStatement( "Another test comment" ) );
collection->AddRange( commentsCollection );

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

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

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

// Inserts a CodeCommentStatement at index 0 of the collection.
collection->Insert( 0, gcnew CodeCommentStatement( "Test comment" ) );

// Removes the specified CodeCommentStatement from the collection.
CodeCommentStatement^ comment = gcnew CodeCommentStatement( "Test comment" );
collection->Remove( comment );

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

// Adds a CodeCommentStatement to the collection.
collection.Add( new CodeCommentStatement("Test comment") );

// Adds an array of CodeCommentStatement objects to the collection.
CodeCommentStatement[] comments = { new CodeCommentStatement("Test comment"), new CodeCommentStatement("Another test comment") };
collection.AddRange( comments );

// Adds a collection of CodeCommentStatement objects to the collection.
CodeCommentStatementCollection commentsCollection = new CodeCommentStatementCollection();
commentsCollection.Add( new CodeCommentStatement("Test comment") );
commentsCollection.Add( new CodeCommentStatement("Another test comment") );
collection.AddRange( commentsCollection );

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

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

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

// Inserts a CodeCommentStatement at index 0 of the collection.
collection.Insert( 0, new CodeCommentStatement("Test comment") );

// Removes the specified CodeCommentStatement from the collection.
CodeCommentStatement comment = new CodeCommentStatement("Test comment");
collection.Remove( comment );

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

' Adds a CodeCommentStatement to the collection.
collection.Add(New CodeCommentStatement("Test comment"))

' Adds an array of CodeCommentStatement objects to the collection.
Dim comments As CodeCommentStatement() = {New CodeCommentStatement("Test comment"), New CodeCommentStatement("Another test comment")}
collection.AddRange(comments)

' Adds a collection of CodeCommentStatement objects to the 
' collection.
Dim commentsCollection As New CodeCommentStatementCollection()
commentsCollection.Add(New CodeCommentStatement("Test comment"))
commentsCollection.Add(New CodeCommentStatement("Another test comment"))
collection.AddRange(commentsCollection)

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

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

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

' Inserts a CodeCommentStatement at index 0 of the collection.
collection.Insert(0, New CodeCommentStatement("Test comment"))

' Removes the specified CodeCommentStatement from the collection.
Dim comment As New CodeCommentStatement("Test comment")
collection.Remove(comment)

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

Remarques

La classe CodeCommentStatementCollection fournit un objet de collection simple qui peut être utilisé pour stocker un ensemble d'objets CodeCommentStatement.

Constructeurs

CodeCommentStatementCollection()

Initialise une nouvelle instance de la classe CodeCommentStatementCollection.

CodeCommentStatementCollection(CodeCommentStatement[])

Initialise une nouvelle instance de la classe CodeCommentStatementCollection contenant le tableau d'objets CodeCommentStatement spécifié.

CodeCommentStatementCollection(CodeCommentStatementCollection)

Initialise une nouvelle instance de la classe CodeCommentStatementCollection contenant les éléments de la collection source spécifiée.

Propriétés

Capacity

Obtient ou définit le nombre d'éléments que CollectionBase peut contenir.

(Hérité de CollectionBase)
Count

Obtient le nombre d'éléments contenus dans l'instance CollectionBase. Cette propriété ne peut pas être remplacée.

(Hérité de CollectionBase)
InnerList

Obtient ArrayList contenant la liste des éléments dans l'instance de CollectionBase.

(Hérité de CollectionBase)
Item[Int32]

Obtient ou définit l'objet CodeCommentStatement à l'index spécifié dans la collection.

List

Obtient IList contenant la liste des éléments dans l'instance de CollectionBase.

(Hérité de CollectionBase)

Méthodes

Add(CodeCommentStatement)

Ajoute l'objet CodeCommentStatement spécifié à la collection.

AddRange(CodeCommentStatement[])

Copie les éléments du tableau CodeCommentStatement spécifié à la fin de la collection.

AddRange(CodeCommentStatementCollection)

Copie le contenu d'un autre objet CodeCommentStatementCollection à la fin de la collection.

Clear()

Supprime tous les objets de l'instance de CollectionBase. Cette méthode ne peut pas être substituée.

(Hérité de CollectionBase)
Contains(CodeCommentStatement)

Obtient une valeur qui indique si la collection contient l'CodeCommentStatement spécifiée.

CopyTo(CodeCommentStatement[], Int32)

Copie les objets de la collection vers le Array unidimensionnel spécifié, en commençant à l'index spécifié.

Equals(Object)

Détermine si l'objet spécifié est égal à l'objet actuel.

(Hérité de Object)
GetEnumerator()

Retourne un énumérateur qui itère au sein de l'instance CollectionBase.

(Hérité de CollectionBase)
GetHashCode()

Fait office de fonction de hachage par défaut.

(Hérité de Object)
GetType()

Obtient le Type de l'instance actuelle.

(Hérité de Object)
IndexOf(CodeCommentStatement)

Obtient l'index de l'objet CodeCommentStatement spécifié dans la collection, s'il existe dans la collection.

Insert(Int32, CodeCommentStatement)

Insère un objet CodeCommentStatement dans la collection à l'index spécifié.

MemberwiseClone()

Crée une copie superficielle du Object actuel.

(Hérité de Object)
OnClear()

Effectue des traitements personnalisés supplémentaires pendant l’effacement du contenu de l’instance de CollectionBase.

(Hérité de CollectionBase)
OnClearComplete()

Exécute des processus personnalisés supplémentaires après l'effacement du contenu de l'instance de CollectionBase.

(Hérité de CollectionBase)
OnInsert(Int32, Object)

Exécute les processus personnalisés supplémentaires avant l'insertion d'un nouvel élément dans l'instance de CollectionBase.

(Hérité de CollectionBase)
OnInsertComplete(Int32, Object)

Exécute les processus personnalisés supplémentaires après l'insertion d'un nouvel élément dans l'instance de CollectionBase.

(Hérité de CollectionBase)
OnRemove(Int32, Object)

Exécute des processus personnalisés supplémentaires lors de la suppression d'un élément de l'instance de CollectionBase.

(Hérité de CollectionBase)
OnRemoveComplete(Int32, Object)

Exécute des processus personnalisés supplémentaires après la suppression d'un élément de l'instance de CollectionBase.

(Hérité de CollectionBase)
OnSet(Int32, Object, Object)

Exécute des processus personnalisés supplémentaires avant la définition d'une valeur dans l'instance de CollectionBase.

(Hérité de CollectionBase)
OnSetComplete(Int32, Object, Object)

Exécute des processus personnalisés supplémentaires après la définition d'une valeur dans l'instance de CollectionBase.

(Hérité de CollectionBase)
OnValidate(Object)

Exécute des processus personnalisés supplémentaires lors de la validation d'une valeur.

(Hérité de CollectionBase)
Remove(CodeCommentStatement)

Supprime l'objet CodeCommentStatement spécifié de la collection.

RemoveAt(Int32)

Supprime l'élément à l'index spécifié de l'instance de CollectionBase. Cette méthode n'est pas substituable.

(Hérité de CollectionBase)
ToString()

Retourne une chaîne qui représente l'objet actuel.

(Hérité de Object)

Implémentations d’interfaces explicites

ICollection.CopyTo(Array, Int32)

Copie l'ensemble de l'objet CollectionBase vers un objet Array unidimensionnel compatible, en commençant à l'index spécifié du tableau cible.

(Hérité de CollectionBase)
ICollection.IsSynchronized

Obtient une valeur indiquant si l’accès à CollectionBase est synchronisé (thread-safe).

(Hérité de CollectionBase)
ICollection.SyncRoot

Obtient un objet qui peut être utilisé pour synchroniser l’accès à CollectionBase.

(Hérité de CollectionBase)
IList.Add(Object)

Ajoute un objet à la fin de la CollectionBase.

(Hérité de CollectionBase)
IList.Contains(Object)

Détermine si CollectionBase contient un élément spécifique.

(Hérité de CollectionBase)
IList.IndexOf(Object)

Recherche le Object spécifié et retourne l’index de base zéro de la première occurrence dans l’ensemble du CollectionBase.

(Hérité de CollectionBase)
IList.Insert(Int32, Object)

Insère un élément dans la classe CollectionBase au niveau de l'index spécifié.

(Hérité de CollectionBase)
IList.IsFixedSize

Obtient une valeur indiquant si CollectionBase est de taille fixe.

(Hérité de CollectionBase)
IList.IsReadOnly

Obtient une valeur indiquant si CollectionBase est en lecture seule.

(Hérité de CollectionBase)
IList.Item[Int32]

Obtient ou définit l'élément au niveau de l'index spécifié.

(Hérité de CollectionBase)
IList.Remove(Object)

Supprime la première occurrence d’un objet spécifique de CollectionBase.

(Hérité de CollectionBase)

Méthodes d’extension

Cast<TResult>(IEnumerable)

Effectue un cast des éléments d'un IEnumerable vers le type spécifié.

OfType<TResult>(IEnumerable)

Filtre les éléments d'un IEnumerable en fonction du type spécifié.

AsParallel(IEnumerable)

Active la parallélisation d'une requête.

AsQueryable(IEnumerable)

Convertit un IEnumerable en IQueryable.

S’applique à

Voir aussi