Is there a way to convert the List<T[]> to an array of the same type T[]?
For example: List<class1[]> to Class[]1 ?
I know we can convert List<T> to array T[] using list.Toarray() but here I'm looking for
List<T[]> to array T[].
Is there a way to convert the List<T[]> to an array of the same type T[]?
For example: List<class1[]> to Class[]1 ?
I know we can convert List<T> to array T[] using list.Toarray() but here I'm looking for
List<T[]> to array T[].
You appear to be turning a List of Lists into one flat list.
If you are in C#, there are Linq utility functions for this:
// Namespaces you need
using System.Linq;
using System.Collections.Generic;
////////////////////////////////////////////
// In your code block //
////////////////////////////////////////////
List<T[]> myJaggedList = new List<T[]>();
// (Populate here)
T[] flatArray = myJaggedList.SelectMany(m => m).ToArray();
The Java Class List contains a function List.toArray(). Here is the Documentation.
Edit: There is a generic List.toArray() as well <T> T[] toArray(T[] a) see the same documentation from above.