Click here to Skip to main content
15,891,785 members
Articles / Programming Languages / C#

Convert ArrayList to a Generic List

Rate me:
Please Sign up or sign in to vote.
4.71/5 (7 votes)
24 Mar 2010CPOL 48.5K   10  
There is a short cut way to convert ArrayList to a generic list instead of looping through items.Generally this is what people do :omg: List orders = new List(myArrayList.count); foreach (WarriorTrading.Order order in myArrayList) { orders.add(order); }But this...

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
23 Oct 2011Michael Freidgeim
You can filter all elements of arrayList that can be cast to the same type using Enumerable.OfType(Of TResult) Method[^]. List typedList = arrayList.OfType().ToList();

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Vizrt Bangladesh
Bangladesh Bangladesh
I am truly versatile and 360 degree Engineer having wide range of development experience in .NET and Java Platform. I am also proficient in system level programming in C++. To me technology is not at all a problem, it’s the client requirement that matters! That is I am ready and comfortable to use any technology to make the business of my client a success.

In my five years of experience I have the opportunities to work for fortune 500 companies of US and many renowned clients from Europe.

My Linkedin Profile: http://bd.linkedin.com/in/mahmudazad

Comments and Discussions