RepeaterItemCollection.CopyTo Method (Array, Int32)
.NET Framework (current version)
Copies all the items from this RepeaterItemCollection to the specified System.Array object, starting at the specified index in the System.Array object.
Assembly: System.Web (in System.Web.dll)
Parameters
- array
-
Type:
System.Array
A zero-based System.Array that receives the copied items from the RepeaterItemCollection.
- index
-
Type:
System.Int32
The first position in the specified System.Array to receive the copied contents.
Implements
ICollection.CopyTo(Array, Int32)Use this method to copy the contents of the RepeaterItemCollection into the specified System.Array object, starting at the specified index.
Note |
|---|
The array parameter must be a zero-based System.Array object. |
To see this code in the context of a complete example, see the RepeaterItemCollection class topic.
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
.NET Framework
Available since 1.1
Available since 1.1
Show:
