ParserErrorCollection.CopyTo(ParserError[], Int32) 메서드

정의

컬렉션의 ParserError 개체를 대상 배열의 지정된 인덱스에서 시작하여 호환되는 1차원 배열에 복사합니다.

public:
 void CopyTo(cli::array <System::Web::ParserError ^> ^ array, int index);
public void CopyTo(System.Web.ParserError[] array, int index);
member this.CopyTo : System.Web.ParserError[] * int -> unit
Public Sub CopyTo (array As ParserError(), index As Integer)

매개 변수

array
ParserError[]

컬렉션의 파서 오류가 복사되는 형식 ParserError 의 배열입니다.

index
Int32

복사할 배열 내의 ParserError 첫 번째 인덱스입니다.

예제

다음 코드 예제에서는 개체의 ParserErrorCollection 내용을 지정된 ParserError 배열에 복사하는 방법을 보여 줍니다.

// Copy the contents of the collection to a
// compatible array, starting at index 0 of the
// destination array. 
ParserError[] errorsToSort = new ParserError[5];
collection.CopyTo(errorsToSort, 0);
' Copy the contents of the collection to a
' compatible array, starting at index 0 of the
' destination array. 
Dim errorsToSort(5) As ParserError
collection.CopyTo(errorsToSort, 0)

설명

이 메서드를 CopyTo 사용하여 컬렉션의 ParserError 개체(포함된 항목 참조 포함)를 지정된 인덱스에서 시작하여 호환되는 배열에 복사합니다. 이 방법은 메서드를 사용하여 ParserError 컬렉션의 개체를 Sort 정렬하려는 경우에 유용합니다. 이 작업을 수행하려면:

  1. 호환되는 ParserError 배열에 개체를 복사합니다.

  2. 배열을 정렬합니다.

  3. 메서드를 Remove 사용하여 컬렉션에서 모든 개체를 ParserError 제거합니다.

  4. AddRange 정렬된 배열을 컬렉션에 다시 추가하려면 이 메서드를 사용합니다.

적용 대상