RepeaterItemCollection.CopyTo メソッド
アセンブリ: System.Web (system.web.dll 内)

Dim instance As RepeaterItemCollection Dim array As Array Dim index As Integer instance.CopyTo(array, index)

このメソッドを使用して、指定した System.Array オブジェクトに RepeaterItemCollection の内容をコピーします。コピー操作は、指定したインデックスから開始されます。
![]() |
---|
array パラメータは、インデックス番号が 0 から始まる System.Array オブジェクトにする必要があります。 |

このコード例の全体像については、RepeaterItemCollection クラスのトピックを参照してください。
Sub CopyTo_Clicked(Sender As Object, e As EventArgs) labelDisplay.Text = "Invoking CopyTo method.<br>" labelDisplay.Text += "The Items collection contains: <br>" ' Display the elements of the RepeaterItemCollection using the CopyTo method. Dim myItemCollection As RepeaterItemCollection = myRepeater.Items Dim myItemArray(myItemCollection.Count-1) As RepeaterItem myItemCollection.CopyTo(myItemArray, 0) Dim index As Integer For index = 0 To myItemArray.Length - 1 Dim myItem As RepeaterItem = CType(myItemArray.GetValue(index), RepeaterItem) labelDisplay.Text += CType(myItem.Controls(0), DataBoundLiteralControl).Text + "<br>" Next index End Sub 'CopyTo_Clicked
void CopyTo_Clicked(Object Sender, EventArgs e) { labelDisplay.Text = "Invoking CopyTo method.<br>"; labelDisplay.Text += "The Items collection contains: <br>"; // Display the elements of the RepeaterItemCollection using the CopyTo method. RepeaterItemCollection myItemCollection = myRepeater.Items; RepeaterItem[] myItemArray = new RepeaterItem[myItemCollection.Count]; myItemCollection.CopyTo(myItemArray,0); for(int index=0;index < myItemArray.Length;index++) { RepeaterItem myItem = (RepeaterItem)myItemArray.GetValue(index); labelDisplay.Text += ((DataBoundLiteralControl) myItem.Controls[0]).Text + "<br>"; } }

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- RepeaterItemCollection.CopyTo メソッドのページへのリンク