C#生成隨機ArrayList的方法
更新時間:2015年06月29日 12:30:33 作者:pythoner
這篇文章主要介紹了C#生成隨機ArrayList的方法,實例分析了C#中ArrayList的相關操作技巧,需要的朋友可以參考下
本文實例講述了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#程序設計有所幫助。
您可能感興趣的文章:
- C#常見的幾種集合 ArrayList,Hashtable,List<T>,Dictionary<K,V> 遍歷方法對比
- C#檢查指定對象是否存在于ArrayList集合中的方法
- C#中Array與ArrayList用法及轉換的方法
- C#中ArrayList的使用方法
- 淺析C#中數組,ArrayList與List對象的區(qū)別
- C#.Net ArrayList的使用方法
- C#查找對象在ArrayList中出現位置的方法
- c# ArrayList的使用方法小總結
- C#中Arraylist的sort函數用法實例分析
- C#中數組、ArrayList、List、Dictionary的用法與區(qū)別淺析(存取數據)
- C#中數組、ArrayList和List三者的區(qū)別詳解及實例
- C#入門教程之集合ArrayList用法詳解
相關文章
C# WinForm程序處理后臺繁忙導致前臺控件假死現象解決方法
這篇文章主要介紹了C# WinForm程序處理后臺繁忙導致前臺控件假死現象解決方法,本文通過Application.DoEvents()解決這個問題,并講解了Application.DoEvents()的作用,需要的朋友可以參考下2015-06-06

