protected void btnArrayForloop_Click(object sender, EventArgs e)
{
string[] array = new string[3];
array[0] = "Thanks";
array[1] = "Pabitra";
array[2] = "Behera";
for (int i = 0; i < array.Length; i++)
{
// Get element by index.
string element = array[i];
Response.Write(element);
}
Console.WriteLine(); // Write blank line.
foreach (string element in array)
{
// Cannot assign element in this loop.
Response.Write(element);
}
//Array Length
Response.Write(array [array .Length - 1]);
}
{
string[] array = new string[3];
array[0] = "Thanks";
array[1] = "Pabitra";
array[2] = "Behera";
for (int i = 0; i < array.Length; i++)
{
// Get element by index.
string element = array[i];
Response.Write(element);
}
Console.WriteLine(); // Write blank line.
foreach (string element in array)
{
// Cannot assign element in this loop.
Response.Write(element);
}
//Array Length
Response.Write(array [array .Length - 1]);
}
No comments:
Post a Comment