<html>
<head>
<title>C# Primer: Single-Dimension Array Example</title>
<link rel="stylesheet" href="/shared/netdemos.css">
<script language="C#" runat="server">
// declare and assign values to the array
string [ ] aColors = {
"AQUA","BLACK","BLUE","FUCHSIA",
"GRAY","GREEN","LIME","MAROON",
"NAVY","OLIVE","PURPLE","RED",
"SILVER","TEAL","WHITE","YELLOW"};
</script>
</head>
<body>
<!-- #include virtual="~/shared/top.inc -->
<div class="header"><h2>C# Primer: <span class="hilite">Single-Dimension Array</span> Example</h2></div>
<hr size=1 width=92%>
<center>
<p>
<table width=60% cellpadding=3 cellspacing=0 border>
<tr>
<th>Index</th>
<th>Values</th>
<th>Example of Using Array Values</th>
<tr>
<% // Loop thru the contents of the array
// and render each item’s index and value into table cells.
for ( int i = 0; i < aColors.Length; i++ ) { %>
<td><%= i %></td>
<td><font color='<%= aColors [ i ] %>'><%= aColors [ i ] %></font></td>
<td bgcolor='<%= aColors [ i ] %>'> </td></tr>
<% } %>
</table>
<p>
</center>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>