For each loop for string (C#)
<%@ Page Language="C#" %>
<script runat="server">
void page_Load()
{
string[] arrCities = new string[3];
arrCities[0]=("A");
arrCities[1]=("B");
arrCities[2]=("C");
foreach (string item in arrCities) {
lblOut.Text += item + "<BR>";
}
}
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:Label runat="server" ID="lblOut"/><br/>
</form>
</body>
</html>
Related examples in the same category