Initialize an int array
IntArray.aspx
<%@ Page Language="C#" %>
<!DOCTYPE html>
<script runat="server">
protected void Button1_Click(object sender, System.EventArgs e)
{
Label1.Text = "Int array created successfully!<br />Array element is: ";
int[] myNumbers = {1,2,3,4,5,6,7,8 };
foreach (int element in myNumbers)
{
Label1.Text += element.ToString()+" ";
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>How to create an int array in asp.net</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Fuchsia">asp.net array example: Int Array</h2>
<asp:Label
ID="Label1"
runat="server"
Font-Size="Large"
ForeColor="OrangeRed"
Font-Bold="true"
Font-Italic="true"
>
</asp:Label>
<br /><br />
<asp:Button
ID="Button1"
runat="server"
OnClick="Button1_Click"
Font-Bold="true"
Text="Create Int Array"
ForeColor="DarkGreen"
/>
</div>
</form>
</body>
</html>

- How to clear an array
- How to sort an array elements
- How to reverse an array elements
- How to initialize a two dimensional int array
- How to perform for loop through a two dimensional array elements
- Array initialization syntaxes
- How to get the average of an int array elements
- 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