C#生成随机ArrayList的方法
时间:2021-04-08 10:40:56|栏目:.NET代码|点击: 次
本文实例讲述了C#生成随机ArrayList的方法。分享给大家供大家参考。具体实现方法如下:
public static void RandomizeArrayList(ArrayList arrayList, Random random) {
if(arrayList == null) { return; }
int count = arrayList.Count;
for(int i=0;i<count;i++) {
Object tmp = arrayList[i];
arrayList.RemoveAt(i);
arrayList.Insert(random.Next(count), tmp);
}
}
希望本文所述对大家的C#程序设计有所帮助。
上一篇:简单使用BackgroundWorker创建多个线程的教程
栏 目:.NET代码
下一篇:为GridView的行添加鼠标经过、点击事件的小例子
本文标题:C#生成随机ArrayList的方法
本文地址:http://www.codeinn.net/misctech/97335.html






