ValidatorCollection.CopyTo(Array, Int32) 메서드

정의

지정된 배열의 특정 위치부터 검사기 컬렉션을 복사합니다.

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)

매개 변수

array
Array

유효성 검사 서버 컨트롤이 추가될 컬렉션입니다.

index
Int32

유효성 검사 서버 컨트롤이 복사될 인덱스입니다.

구현

예제

다음 코드 예제는 CopyTo 메서드.

// 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

적용 대상

추가 정보