The things I learnt while I migrated from classic asp to asp.net is given here for my reference as well as for new beginners.

SINGLE DIMENTIONAL ARRAY C#

ARRAY IN C#

OF ASP.NET

- SAMPLE PROGRAM CODE

Array is a frequently used concept in any Programming Language. Whichever language you are learning, you should know how create and manipulate an Array.

Here the complete code for webpage which uses a Single Dimentional Array is given. Just copy this code and save it as say : test.aspx and run it.

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

<script runat="server">

protected void Button1_Click(object sender, System.EventArgs e)
{
string[] myArray = { "raja","roja","pooja","kaja"};
Label1.Text = "My Friends are :<br />";
foreach (string myItem in myArray)
{
Label1.Text += myItem + "<br />";
}

}
</script>

<html >
<head id="Head1" runat="server">
<title>Array Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="Label1" runat="server"></asp:Label>
<asp:Button OnClick="Button1_Click" ID="Button1"
runat="server" Text="View My Friends"/>
</form>
</body>
</html>

Some useful Array Commands

string[] myArray = new string[5];

Label1.Text = MyArray.GetValue(2).ToString();

 

int [] myArray;
my Array = new int[5];

 

int [] myArray;
my Array = new int[3]{5, 12, 23};

 

string[] myArray = {"raja", "roja", "pooja"};

 

 

 

 

Important Properties of an Array:

GetLowerBound,GetUpperBound,IndexOf,GetValue,Length,



Thanks for Your Visit

Google Search
Disclaimer and Copy Right