<"Ignacio Machin \( .NET/ C# MVP \)" <ignacio.machin AT
dot.state.fl.us>> wrote:
You should do this inside a try/catch block as ArrayList do not check that
all the elements being of the same type.
Yes it does - it *has* to when you provide a type to ToArray, otherwise
it wouldn't be able return an array of the appropriate type. So ToArray
will throw an exception if the elements aren't of an appropriate type.
Or did you mean that it doesn't check the elements when they're put
into the list?
I wouldn't suggest putting it in a try/catch block though - if that
fails, chances are you've got some nasty internal error, and the
exception should probably bubble up to a higher level.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too