CodeDirectiveCollection.CopyTo(CodeDirective[], Int32) 메서드

정의

지정된 인덱스에서 시작하는 1차원 배열에 컬렉션의 내용을 복사합니다.

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

매개 변수

array
CodeDirective[]

컬렉션에서 복사된 값의 대상인 CodeDirective 형식의 배열입니다.

index
Int32

컬렉션 개체의 삽입을 시작할 배열의 인덱스입니다.

예외

대상 배열이 다차원 배열인 경우

또는

CodeDirectiveCollection의 요소 수가 index에서 지정하는 대상 배열 인덱스와 대상 배열 끝 사이의 사용 가능한 공간보다 큰 경우

array이(가) null인 경우

index가 대상 배열의 최소 인덱스보다 작은 경우

예제

다음 코드 예제에서는 사용 CopyTo 하는 메서드를 지정 된 CodeDirective 배열에 인덱스 0에서 시작 하는 컬렉션의 콘텐츠를 복사 합니다. 이 예제는에 대해 제공 된 큰 예제의 일부는 CodeDirectiveCollection 클래스입니다.

// Copies the contents of the collection beginning at index 0 to the specified CodeDirective array.
// 'directives' is a CodeDirective array.
collection.CopyTo(directives, 0);
' Copies the contents of the collection beginning at index 0 to the specified CodeDirective array.
' 'directives' is a CodeDirective array.
collection.CopyTo(directives, 0)

적용 대상