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 メソッドを使用します。

適用対象