Abstract: make good use IEnumerable and array-take-all method List
Because the array with List
the parameter declaration can-take-all method for IEnumerable and array List
As follows:
private void ListAllElement(IEnumerable elements)
{
foreach (int element in elements)
{
Console.WriteLine(element);
}
}
int[] a = { 1, 2, 3 };
List b = new List { 4, 5, 6 };
ListAllElement(a);
ListAllElement(b);
Of course, not only List
Original: Large column [C #] make good use of IEnumerable <T> method to make take-array with List <T>