Get array element by index (C#) : Array « Collections « ASP.Net






Get array element by index (C#)

<%@Page Language="c#" %>
<script runat="server" Language="c#">
  void Page_Load() 
  {
    string[] AnimalArray = new string[5]{  "Dog", "Cat", "Elephant", "Lion", "Cat"};
    MyLabel.Text = AnimalArray.GetValue(2).ToString();
  }
</script>
<html>
  <asp:label id="MyLabel" runat="server" />
</html>

           
       








Related examples in the same category

1.Array Reverse Demo (VB.net)
2.For Each loop through an Array (VB.net)
3.Array.IndexOf and Array.LastIndexOf (VB.net)
4.Get array by index (VB.net)
5.Sort an Array (VB.net)
6.For each loop: array (VB.net)
7.Change array length (VB.net)
8.Define and use array (VB.net)
9.Sort array reversely (C#)
10.Array.IndexOf(), Array.LastIndexOf() (C#)
11.Use String Array to store Asp Label Text (C#)
12.Use Two dimensional array (C#)
13.Use array: find item index (C#)