Convert ArrayList to a Generic List






4.67/5 (2 votes)
You can filter all elements of arrayList that can be cast to the same type using Enumerable.OfType(Of TResult) Method[^]. List typedList = arrayList.OfType().ToList();
You can filter all elements of
arrayList
that can be cast to the same type using Enumerable.OfType(Of TResult) Method[^].
List<myclass> typedList = arrayList.OfType<myclass>().ToList();