I am trying to do something in C #, which I easily do in Java. But there are problems. I have an undefined number of arrays of objects of type T. A implements the interface I. I need the array I at the end, which is the sum of all the values ββfrom all arrays. Assume that no arrays will contain the same values.
This Java code works.
ArrayList<I> list = new ArrayList<I>(); for (Iterator<T[]> iterator = arrays.iterator(); iterator.hasNext();) { T[] arrayOfA = iterator.next();
However, this C # code does not:
List<I> list = new List<I>(); foreach (T[] arrayOfA in arrays) {
So, obviously, I need to somehow get an array of T[] in IEnumerable<I> to add to the list, but I'm not sure if this is the best way to do this? Any suggestions?
EDIT: development in VS 2008, but it needs to be compiled for .NET 2.0.
source share