ArrayList CopyTo() method with range in asp.net c#

ArrayList CopyTo() method with range
ArrayListCopyToMethodWithElementsRange.aspx

<%@ Page Language="C#" AutoEventWireup="true" %>

<!DOCTYPE html>

<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        ArrayList colors = new ArrayList() {"Red","DarkRed","IndianRed","MediumVioletRed"};

        Label1.Text = "ArrayList Elements....";
        foreach (string color in colors)
        {
            Label1.Text += "<br />" + color;
        }

        string[] colorArray = {"Olive","OliveDrab","SeaGreen","ForestGreen","MediumSeaGreen"};
        Label1.Text += "<font color=SeaGreen>";
        Label1.Text += "<br /><br />Array Elements...";
        foreach (string color in colorArray)
        {
            Label1.Text += "<br />" + color;
        }
        Label1.Text += "</font>";

        colors.CopyTo(1,colorArray,2,2);
        Label1.Text += "<font color=OrangeRed>";
        Label1.Text += "<br /><br />After Call CopyTo(Int32, Array, Int32, Int32) Method";
        Label1.Text += "<br />CopyTo(List Index 1, Array, arrayindex 2, count 2) Array Elements...";
        foreach (string color in colorArray)
        {
            Label1.Text += "<br />" + color;
        }
        Label1.Text += "</font>";
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to copy a range of elements from the ArrayList to a compatible Array, starting at the specified index of the array</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:MidnightBlue; font-style:italic;">
            System.Collections.ArrayList CopyTo(Int32, Array, Int32, Int32) Method
            <br /> How to copy ArrayList to a compatible
            <br /> Array, starting at the specified index of the array
        </h2>
        <hr width="525" align="left" color="Navy" />
        <br />
        <asp:Label
             ID="Label1"
             runat="server"
             ForeColor="Crimson"
             Font-Size="Large"
             Font-Names="Courier New"
             Font-Italic="true"
             Font-Bold="true"
             >
        </asp:Label>
        <br /><br />
        <asp:Button 
            ID="Button1"
            runat="server"
            OnClick="Button1_Click"
            Text="Test ArrayList CopyTo(Int32, Array, Int32, Int32) Method"
            Height="45"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            />
    </div>
    </form>
</body>
</html>
More asp.net examples