ValidatorCollection.CopyTo(Array, Int32) Metoda

Definicja

Kopiuje kolekcję modułu sprawdzania poprawności do określonej tablicy, zaczynając od określonej lokalizacji.

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

Kolekcja, do której dodano kontrolkę serwera weryfikacji.

index
Int32

Indeks, w którym jest kopiowany formant serwera weryfikacji.

Implementuje

Przykłady

Poniższy przykład kodu pokazuje użycie 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

Dotyczy

Zobacz też