By default ArrayList ToArray copies the list to object[]. There is an
override that allows the specification of a type:
ArrayList.ToArray(System.Type)... however, I have been unable to correctly
specify the system type or to figure out how to easily convert the object[]
to an int[].
Any ideas??
Thanks in advance.
Chuck
Mattias Sjögren - 25 Aug 2005 21:04 GMT
>however, I have been unable to correctly
>specify the system type or to figure out how to easily convert the object[]
>to an int[].
>Any ideas??
If the ArrayList contains all boxed ints you can do
int[] arr = (int[])yourArrayList.ToArray(typeof(int));
Mattias

Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.