Sort array reversely (C#) : Array « Collections « ASP.Net






Sort array reversely (C#)

<%@Page Language="c#" %>
<script runat="server" Language="c#">
  void Page_Load()
  {
    string[] AnimalArray = new string[5]
                 { "Dog", "Cat", "Elephant", "Lion", "Cat" };
    Array.Reverse(AnimalArray);
    foreach (string strAnimal in AnimalArray)
    {
      MyDropDownList.Items.Add(strAnimal);
    }
  }
</script>
<html>
<form id="Form1" method="post" runat="server">
<asp:dropdownlist id="MyDropDownList" runat="server" />
</form>
</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.Get array element by index (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#)