T
timor.super
Hi group,
please look at my generic method :
static void Write<T>(IEnumerable<IEnumerable<T>> list)
{
foreach (IEnumerable<T> ts in list)
{
foreach (T t in ts)
{
Console.WriteLine(t);
}
Console.WriteLine();
}
}
static void Main()
{
List<List<int>> list = new List<List<int>>(new List<int>[]
{new List<int>(new int[] {1, 2, 3}), new List<int>(new int[] {3, 4,
5}), new List<int>(new int[] {4, 5, 6})});
List<List<string>> list2 = new List<List<string>>(new
List<string>[] { new List<string>(new string[] { "ab", "bc" }), new
List<string>(new string[] { "aa" }), new List<string>(new string[]
{ "bb" }) });
Write(list.ToArray());
Write(list2.ToArray());
}
My purpose is to have an IEnumerable of IEnumerable (for example array
of array) and write the content
But I'm not able to apply constraint. (should I)
Is it the good way to make such a method ? Is there a better way ?
Thanks for your help,
Best regard
please look at my generic method :
static void Write<T>(IEnumerable<IEnumerable<T>> list)
{
foreach (IEnumerable<T> ts in list)
{
foreach (T t in ts)
{
Console.WriteLine(t);
}
Console.WriteLine();
}
}
static void Main()
{
List<List<int>> list = new List<List<int>>(new List<int>[]
{new List<int>(new int[] {1, 2, 3}), new List<int>(new int[] {3, 4,
5}), new List<int>(new int[] {4, 5, 6})});
List<List<string>> list2 = new List<List<string>>(new
List<string>[] { new List<string>(new string[] { "ab", "bc" }), new
List<string>(new string[] { "aa" }), new List<string>(new string[]
{ "bb" }) });
Write(list.ToArray());
Write(list2.ToArray());
}
My purpose is to have an IEnumerable of IEnumerable (for example array
of array) and write the content
But I'm not able to apply constraint. (should I)
Is it the good way to make such a method ? Is there a better way ?
Thanks for your help,
Best regard