Hi group,
please look at my generic method :
static void Write<T>(IEnume rable<IEnumerab le<T>list)
{
foreach (IEnumerable<Tt s in list)
{
foreach (T t in ts)
{
Console.WriteLi ne(t);
}
Console.WriteLi ne();
}
}
static void Main()
{
List<List<int>l ist = 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<strin g>list2 = new List<List<strin g>>(new
List<string>[] { new List<string>(ne w string[] { "ab", "bc" }), new
List<string>(ne w string[] { "aa" }), new List<string>(ne w string[]
{ "bb" }) });
Write(list.ToAr ray());
Write(list2.ToA rray());
}
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>(IEnume rable<IEnumerab le<T>list)
{
foreach (IEnumerable<Tt s in list)
{
foreach (T t in ts)
{
Console.WriteLi ne(t);
}
Console.WriteLi ne();
}
}
static void Main()
{
List<List<int>l ist = 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<strin g>list2 = new List<List<strin g>>(new
List<string>[] { new List<string>(ne w string[] { "ab", "bc" }), new
List<string>(ne w string[] { "aa" }), new List<string>(ne w string[]
{ "bb" }) });
Write(list.ToAr ray());
Write(list2.ToA rray());
}
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
Comment