I was using ArrayList.CopyTo(Array) to convert arraylist to a type array.
I thought ArrayList.ToArray(Type) was for intrinsic types (int, string etc.) but forgot that one the facilitites of OOP is that types that we define can be treated as instinsic types for most occasions. Today I came across a code that showed the use of ArrayList.ToArray(Type) for a type defined by the programmer.
here mConstacts is of type ArrayList, and Contact is a class.
I was doing the following till now :-
Contact contacts = new Contact[mContacts.Count];
I have yet to peek into the IL to see the difference/similarity between the two approaches in terms of internals, but the first one at least requires less code and fits in a single line. :-)