如下边代码所示,我写在了一个按钮事件里,点击按钮,没结果,也不报错,新手刚学习C#,求具体指导,谢谢
protected void btn1_Click(object sender, EventArgs e)
{
//随机产生100个元素的数组
int[] intArr = new int[100];
ArrayList myList = new ArrayList();
Random rnd = new Random();
while (myList.Count < 100)
{
int num = rnd.Next(1, 100);
if (!myList.Contains(num))
myList.Add(num);
}
for (int i = 0; i < 100; i++)
intArr[i] = (int)myList[i];
for (int j = 0; j < intArr.Length; j++)
{
Console.Write("{0},\t", intArr[j]);
}
}
元芳怎么了