First of all, you should design your code the way the "conversion" (but in this case this is not "conversion" but
type cast from interface type to interface implementing type is never needed. If you clearly expected your purpose, I would probably be able to explain how to avoid it on your example.
Second of all, you should not use
ArrayList
in new development. This type is rendered obsolete as early as of v.2.0, when generics were introduced. You should use strongly typed approach with the generic type
System.Collections.Generic.List<>
or other generic collection types. Please see:
http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx[
^],
http://msdn.microsoft.com/en-us/library/System.Collections.Generic.aspx[
^].
This class wasn't formally marked obsolete only because there is nothing wrong with using it in legacy project which are otherwise backward-compatible with newer versions of the .NET framework. For new development it simply makes no sense, as not strongly typed collections require type case, which is an extra potential source of bugs.
—SA