I need to convert the linq query from generic ienumerable to arraylist.
ArrayList myArrayList = new ArrayList();
var b =
(from myObj in myCollection
select new myClass
{
Name = myObj.Name,
ac = myObj.ac
});
I have tried doing
b.Cast<ArrayList>();
but it is not working.
Edited : I got it working with @devdigital solution
but i will also want to point out that at same time i found a hackish solution.
myArrayList.InsertRange(0, b.ToArray());
Cast<T>extension casts each element of anIEnumerableand returns them as anotherIEnumerable. It is therefore not useful to convert the collection itself.