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>

- How to clear an array
- How to sort an array elements
- How to perform foreach loop through array elements
- How to initialize a two dimensional array
- How to perform for loop through a two dimensional array elements
- How to convert a string array to a list
- How to convert a string to a byte array
- How to use array any
- How to use linq any operator with a string array
- How to pass an array as a parameter to a method