Define and use array in asp.net page (C#) : Array « Collections « ASP.NET Tutorial






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

<script runat="server">
   string[] arrColors = new string[5];
   
   void Page_Load(Object Sender, EventArgs e) {
      arrColors[0] = "green";
      arrColors[1] = "red";
      arrColors[2] = "yellow";
      arrColors[3] = "blue";
      arrColors[4] = "violet";
      
      Response.Write("The first element is: ");
      Response.Write(arrColors[0] + "");
      
      Response.Write("The third element is: ");
      Response.Write(arrColors[2] + "");
      
      Response.Write("The 5-3 element is: ");
      Response.Write(arrColors[5-3] + "");
   }
</script>

<html><body>

</body></html>








7.1.Array
7.1.1.Define and use array in asp.net page (VB)
7.1.2.Define and use array in asp.net page (C#)
7.1.3.Looking for an object in an array by reference (C#)
7.1.4.Looking for an object in an array by reference (VB)
7.1.5.Searching for a object in an array by reference (C#)
7.1.6.Searching for a object in an array by reference (VB)
7.1.7.Searching for an equivalent object with Array.BinarySearch (C#)
7.1.8.Searching for an equivalent object with Array.BinarySearch (VB)
7.1.9.Sorting arrays of Person (C#)
7.1.10.Sorting arrays of Person (VB)
7.1.11.Array with custom objects
7.1.12.Array binding