<%
ArrayList myArray = new ArrayList();
int number;
System.Random num = new Random();
for (int i = 0; i < 30; i++)
{
do
{
number = num.Next(1, 50);
} while (myArray.IndexOf(number.ToString()) != -1);
myArray.Add(number.ToString());
}
var sortedmyArray = myArray.Cast<string>().OrderBy(item => int.Parse(item));
foreach (var a in
sortedmyArray)
{
Response.Write("<LI>" + a);
}
%>
沒有留言:
張貼留言