How can I convert/dump an arraylist into a list? I’m using arraylist because I’m using the ASP.NET profiles feature and it looked like a pain to store List in profiles.
Note:
The other option would be to wrap the List into an own class and do away with ArrayList.
http://www.ipreferjim.com/site/2009/04/storing-generics-in-asp-net-profile-object/
The easiest way to convert an
ArrayListfull of objects of typeTwould be this (assuming you’re using .NET 3.5 or greater):If you’re using 3.0 or earlier, you’ll have to loop yourself: