Created
October 21, 2018 12:18
-
-
Save mariusGundersen/7092b846fdee640ecd7e1f37eee7255c to your computer and use it in GitHub Desktop.
Revisions
-
mariusGundersen created this gist
Oct 21, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ // Example 6: Add a list // This is just a dummy method that returns some ints public static IEnumerable<int> GetAnotherListOfInts() => new[] { 10, 11, 12, 13 }; // With this extension method... public static void Add<T>(this List<T> list, IEnumerable<T> items) => list.AddRange(items); // ...this is possible var result = new List<int> { 1, 2, GetAnotherListOfInts(), 3 }; // Output each item, to see if things work correctly foreach(var item in result){ Console.WriteLine(item); }