Answer:
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.
Asked In: Many Interviews |
Alert Moderator