c# - How to initialize a two dimensional int array

Initializing two dimensional int array
TwoDimensionIntArray.aspx

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

<!DOCTYPE html>

<script runat="server">

    protected void Button1_Click(object sender, System.EventArgs e)
    {
        int[,] numberArray = {{1,2},{3,4},{5,6},{7,8},{9,10} };
        Label1.Text = "Two dimensional Int array created successfully!<br />Array elements:<br /><br /><i>";
        int rows = numberArray.GetUpperBound(0);
        int columns = numberArray.GetUpperBound(1);
        Label2.Text = "";

        for (int currentRow = 0; currentRow <= rows; currentRow++)
        {
            for (int currentColumn = 0; currentColumn <= columns; currentColumn++)
            {
                Label2.Text += numberArray[currentRow, currentColumn];
                Label2.Text += " ";
            }
            Label2.Text += "<br />";
        }
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>How to create two dimension int array in asp.net</title>
</head> 
<body>
    <form id="form1" runat="server">
    <div>
        <h2 style="color:Red">asp.net array example: Two Dimension Int Array</h2>
        <asp:Label 
             ID="Label1" 
             runat="server" 
             Font-Size="Large"
             ForeColor="DodgerBlue"
             Font-Bold="true"
             Font-Italic="true"
             >
        </asp:Label>
        <br />
        <asp:Label 
             ID="Label2" 
             runat="server" 
             Font-Size="Large"
             ForeColor="Crimson"
             Font-Bold="true"
             Font-Italic="true"
             >
        </asp:Label>
        <br /><br />
        <asp:Button 
             ID="Button1" 
             runat="server" 
             OnClick="Button1_Click"
             Font-Bold="true"
             Text="Create Two Dimensional Int Array"
             ForeColor="DodgerBlue"
             />   
    </div>
    </form>
</body>
</html>
More c# examples