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

적용 대상

추가 정보