Instead of
ArrayList
, use
System.Collections.Generic.List<>
:
http://msdn.microsoft.com/en-us/library/6sh2ey19%28v=vs.110%29.aspx[
^].
Non-generic non-specialized collections like
ArrayList
was rendered absolute as early as of .NET Framework v.2.0, when generics were introduced, so they should never be used in new development. The were not marked with
[Obsolete]
attribute just because there is nothing wrong with keeping them in already developed and debugged legacy code, but the potentially unsafe need in type cast makes then unsuitable.
—SA