Category Archives: ASP.NET

Casting an ArrayList to a typed array

This caught me out today. When converting an ArrayList to a typed array, remember to cast the array returned by ArrayList.ToArray() string[] arr = (string[]) arrayList.toArray( typeof( string ) );

Posted in ASP.NET, Gotchas | Tagged , , | Leave a comment