ValidatorCollection.CopyTo(Array, Int32) Metoda

Definice

Zkopíruje kolekci validátoru do zadaného pole počínaje zadaným umístěním.

public:
 virtual void CopyTo(Array ^ array, int index);
public void CopyTo (Array array, int index);
abstract member CopyTo : Array * int -> unit
override this.CopyTo : Array * int -> unit
Public Sub CopyTo (array As Array, index As Integer)

Parametry

array
Array

Kolekce, do které je přidán ovládací prvek ověřovacího serveru.

index
Int32

Index, ve kterém se zkopíruje ovládací prvek ověřovacího serveru.

Implementuje

Příklady

Následující příklad kódu ukazuje použití CopyTo metody.

// Get 'Validators' of the page to myCollection.
ValidatorCollection myCollection = Page.Validators ;
// Object Array.
Object[] myObjArray = new Object[5] { 0, 0, 0, 0, 0 };
// Copy the 'Collection' to 'Array'. 
myCollection.CopyTo(myObjArray,0); 
// Print the values in the Array.
string myStr = " ";         
for(int i = 0; i<myCollection.Count; i++)
{
   myStr += myObjArray[i].ToString();
   myStr += " ";
}
msgLabel.Text = myStr;
' Get 'Validators' of the page to myCollection.
Dim myCollection As ValidatorCollection = Page.Validators
Dim myObjArray() As Object = New Object(4){0, 0, 0, 0, 0}
' Copy the 'Collection' to 'Array'. 
myCollection.CopyTo(myObjArray, 0)
' Print the values in the Array.
Dim myStr As String = " "
Dim i As Integer
For i = 0 To myCollection.Count - 1
   myStr += myObjArray(i).ToString()
   myStr += " "
Next i
msgLabel.Text = myStr

Platí pro

Viz také