问题描述
刚开始学,书上说得很简单,不知道具体怎么用我刚开始学,深奥的不懂。。。。
解决方案
解决方案二:
看MSDNC#usingSystem;usingSystem.Collections;publicclassSamplesArrayList{publicstaticvoidMain(){//CreatesandinitializesanewArrayList.ArrayListmyAL=newArrayList();myAL.Add("Hello");myAL.Add("World");myAL.Add("!");//DisplaysthepropertiesandvaluesoftheArrayList.Console.WriteLine("myAL");Console.WriteLine("Count:{0}",myAL.Count);Console.WriteLine("Capacity:{0}",myAL.Capacity);Console.Write("Values:");PrintValues(myAL);}publicstaticvoidPrintValues(IEnumerablemyList){foreach(ObjectobjinmyList)Console.Write("{0}",obj);Console.WriteLine();}}一些resource:http://www.wujianrong.com/archives/2006/11/arraylist.htmlhttp://msdn2.microsoft.com/en-us/library/system.collections.arraylist.aspxhttp://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1615824&SiteID=1