string[] myarray = { "Pabi", "Pabitra", "Gitu", "Ram" };
//Find First Element of an array
//---------------------------------
Response.Write(myarray[0].ToString());
// Last Element
//-----------------
int totalLength = myarray.Length;
int LastItemIndex = totalLength - 1;
Response.Write(myarray[LastItemIndex].ToString());
////Index of an Array
//-----------------
// Tips:
//IndexOf methods return -1 when no element is found. This value often must be checked in an if-statement.
int PositionOfIndex = Array.IndexOf(myarray, "Pabi");
Response.Write(myarray[PositionOfIndex]);
//Find First Element of an array
//---------------------------------
Response.Write(myarray[0].ToString());
// Last Element
//-----------------
int totalLength = myarray.Length;
int LastItemIndex = totalLength - 1;
Response.Write(myarray[LastItemIndex].ToString());
////Index of an Array
//-----------------
// Tips:
//IndexOf methods return -1 when no element is found. This value often must be checked in an if-statement.
int PositionOfIndex = Array.IndexOf(myarray, "Pabi");
Response.Write(myarray[PositionOfIndex]);
No comments:
Post a Comment