↑ Grab this Headline Animator

Tuesday, July 15, 2008

How to convert an ArrayList into an Array?

Lets say you have myPersonList as an ArrayList that has Person object. If you want to convert this ArrayList into array of your Person object, write like this.

Person[] personArray = (Person[])myPersonList.ToArray(typeof(Person));

Here you need to cast the object into its type.

Submit this story to DotNetKicks

No comments:

Post a Comment

Post your comments/questions/feedback for this Article.


Latest Articles