CodeStatementCollection Třída

Definice

Představuje kolekci CodeStatement objektů.

public ref class CodeStatementCollection : System::Collections::CollectionBase
public class CodeStatementCollection : System.Collections.CollectionBase
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeStatementCollection : System.Collections.CollectionBase
type CodeStatementCollection = class
    inherit CollectionBase
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeStatementCollection = class
    inherit CollectionBase
Public Class CodeStatementCollection
Inherits CollectionBase
Dědičnost
CodeStatementCollection
Atributy

Příklady

Následující příklad ukazuje, jak použít CodeStatementCollection třídu . Příklad vytvoří novou instanci třídy a používá několik metod k přidání příkazů do kolekce, vrácení jejich indexu a přidání nebo odebrání příkazů v určitém bodě indexu.

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

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

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

// Adds a collection of CodeStatement objects to the collection.
CodeStatement^ testStatement = gcnew CodeCommentStatement( "Test comment statement" );
CodeStatementCollection^ statementsCollection = gcnew CodeStatementCollection;
statementsCollection->Add( gcnew CodeCommentStatement( "Test comment statement" ) );
statementsCollection->Add( gcnew CodeCommentStatement( "Test comment statement" ) );
statementsCollection->Add( testStatement );
collection->AddRange( statementsCollection );

// Tests for the presence of a CodeStatement in the 
// collection, and retrieves its index if it is found.
int itemIndex = -1;
if ( collection->Contains( testStatement ) )
   itemIndex = collection->IndexOf( testStatement );

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

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

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

// Removes the specified CodeStatement from the collection.
collection->Remove( testStatement );

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

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

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

// Adds a collection of CodeStatement objects to the collection.
CodeStatement testStatement = new CodeCommentStatement("Test comment statement");
CodeStatementCollection statementsCollection = new CodeStatementCollection();
statementsCollection.Add( new CodeCommentStatement("Test comment statement") );
statementsCollection.Add( new CodeCommentStatement("Test comment statement") );
statementsCollection.Add( testStatement );

collection.AddRange( statementsCollection );

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


// Copies the contents of the collection beginning at index 0 to the specified CodeStatement array.
// 'statements' is a CodeStatement array.
CodeStatement[] statementArray = new CodeStatement[collection.Count];
collection.CopyTo( statementArray, 0 );

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

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

// Removes the specified CodeStatement from the collection.
collection.Remove( testStatement );

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

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

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

' Adds a collection of CodeStatement objects to the collection.
Dim testStatement As New CodeStatement
Dim statementsCollection As New CodeStatementCollection
statementsCollection.Add(New CodeCommentStatement("Test comment statement"))
statementsCollection.Add(New CodeCommentStatement("Test comment statement"))
statementsCollection.Add(testStatement)
collection.AddRange(statementsCollection)

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

' Copies the contents of the collection beginning at index 0 to the specified CodeStatement array.
' 'statements' is a CodeStatement array.
Dim statementArray(collection.Count - 1) As CodeStatement
collection.CopyTo(statementArray, 0)

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

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

' Removes the specified CodeStatement from the collection.
collection.Remove(testStatement)

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

Poznámky

Třída CodeStatementCollection poskytuje jednoduchý objekt kolekce, který lze použít k uložení sady CodeStatement objektů.

Konstruktory

CodeStatementCollection()

Inicializuje novou instanci CodeStatementCollection třídy .

CodeStatementCollection(CodeStatement[])

Inicializuje novou instanci CodeStatementCollection třídy, která obsahuje zadané pole CodeStatement objektů.

CodeStatementCollection(CodeStatementCollection)

Inicializuje novou instanci CodeStatementCollection třídy, která obsahuje prvky zadané zdrojové kolekce.

Vlastnosti

Capacity

Získá nebo nastaví počet prvků, které CollectionBase mohou obsahovat.

(Zděděno od CollectionBase)
Count

Získá počet prvků obsažených CollectionBase v instanci. Tuto vlastnost nelze přepsat.

(Zděděno od CollectionBase)
InnerList

Získá obsahující ArrayList seznam prvků v CollectionBase instanci.

(Zděděno od CollectionBase)
Item[Int32]

Získá nebo nastaví CodeStatement objekt v zadaném indexu v kolekci.

List

Získá obsahující IList seznam prvků v CollectionBase instanci.

(Zděděno od CollectionBase)

Metody

Add(CodeExpression)

Přidá zadaný CodeExpression objekt do kolekce.

Add(CodeStatement)

Přidá zadaný CodeStatement objekt do kolekce.

AddRange(CodeStatement[])

Přidá do kolekce sadu CodeStatement objektů.

AddRange(CodeStatementCollection)

Přidá obsah jiného CodeStatementCollection objektu na konec kolekce.

Clear()

Odebere z instance všechny objekty CollectionBase . Tuto metodu nelze přepsat.

(Zděděno od CollectionBase)
Contains(CodeStatement)

Získá hodnotu, která označuje, zda kolekce obsahuje zadaný CodeStatement objekt.

CopyTo(CodeStatement[], Int32)

Zkopíruje prvky objektu CodeStatementCollection do jednorozměrné Array instance počínaje zadaným indexem.

Equals(Object)

Určí, zda se zadaný objekt rovná aktuálnímu objektu.

(Zděděno od Object)
GetEnumerator()

Vrátí enumerátor, který iteruje prostřednictvím CollectionBase instance.

(Zděděno od CollectionBase)
GetHashCode()

Slouží jako výchozí hashovací funkce.

(Zděděno od Object)
GetType()

Type Získá z aktuální instance.

(Zděděno od Object)
IndexOf(CodeStatement)

Získá index zadaného CodeStatement objektu CodeStatementCollectionv , pokud existuje v kolekci.

Insert(Int32, CodeStatement)

Vloží zadaný CodeStatement objekt do kolekce v zadaném indexu.

MemberwiseClone()

Vytvoří mělkou kopii aktuálního Objectsouboru .

(Zděděno od Object)
OnClear()

Provádí další vlastní procesy při vymazání obsahu CollectionBase instance.

(Zděděno od CollectionBase)
OnClearComplete()

Provádí další vlastní procesy po vymazání obsahu CollectionBase instance.

(Zděděno od CollectionBase)
OnInsert(Int32, Object)

Provádí další vlastní procesy před vložením nového prvku do CollectionBase instance.

(Zděděno od CollectionBase)
OnInsertComplete(Int32, Object)

Provádí další vlastní procesy po vložení nového prvku do CollectionBase instance.

(Zděděno od CollectionBase)
OnRemove(Int32, Object)

Provádí další vlastní procesy při odebírání prvku z CollectionBase instance.

(Zděděno od CollectionBase)
OnRemoveComplete(Int32, Object)

Provádí další vlastní procesy po odebrání prvku z CollectionBase instance.

(Zděděno od CollectionBase)
OnSet(Int32, Object, Object)

Před nastavením hodnoty v CollectionBase instanci provede další vlastní procesy.

(Zděděno od CollectionBase)
OnSetComplete(Int32, Object, Object)

Provádí další vlastní procesy po nastavení hodnoty v CollectionBase instanci.

(Zděděno od CollectionBase)
OnValidate(Object)

Provádí další vlastní procesy při ověřování hodnoty.

(Zděděno od CollectionBase)
Remove(CodeStatement)

Odebere zadaný CodeStatement objekt z kolekce.

RemoveAt(Int32)

Odebere prvek v zadaném indexu CollectionBase instance. Tuto metodu nelze přepisovat.

(Zděděno od CollectionBase)
ToString()

Vrátí řetězec, který představuje aktuální objekt.

(Zděděno od Object)

Explicitní implementace rozhraní

ICollection.CopyTo(Array, Int32)

Zkopíruje celek CollectionBase do kompatibilního jednorozměrného Arrayobjektu počínaje zadaným indexem cílového pole.

(Zděděno od CollectionBase)
ICollection.IsSynchronized

Získá hodnotu označující, zda přístup k objektu CollectionBase je synchronizován (bezpečný pro přístup z více vláken).

(Zděděno od CollectionBase)
ICollection.SyncRoot

Získá objekt, který lze použít k synchronizaci přístupu k .CollectionBase

(Zděděno od CollectionBase)
IList.Add(Object)

Přidá objekt na konec objektu CollectionBase.

(Zděděno od CollectionBase)
IList.Contains(Object)

Určuje, zda obsahuje CollectionBase určitý prvek.

(Zděděno od CollectionBase)
IList.IndexOf(Object)

Vyhledá zadaný Object a vrátí index od nuly prvního výskytu v rámci celého CollectionBaseobjektu .

(Zděděno od CollectionBase)
IList.Insert(Int32, Object)

Vloží prvek do objektu CollectionBase v zadaném indexu.

(Zděděno od CollectionBase)
IList.IsFixedSize

Získá hodnotu označující, zda CollectionBase má pevnou velikost.

(Zděděno od CollectionBase)
IList.IsReadOnly

Získá hodnotu, která určuje, zda je CollectionBase určena jen pro čtení.

(Zděděno od CollectionBase)
IList.Item[Int32]

Získá nebo nastaví prvek u zadaného indexu.

(Zděděno od CollectionBase)
IList.Remove(Object)

Odebere první výskyt konkrétního objektu z objektu CollectionBase.

(Zděděno od CollectionBase)

Metody rozšíření

Cast<TResult>(IEnumerable)

Přetypuje prvky objektu na IEnumerable zadaný typ.

OfType<TResult>(IEnumerable)

Filtruje prvky objektu IEnumerable na základě zadaného typu.

AsParallel(IEnumerable)

Umožňuje paralelizaci dotazu.

AsQueryable(IEnumerable)

Převede objekt na IEnumerableIQueryable.

Platí pro

Viz také