Oktatás * Programozás 2 * Szkriptnyelvek * levelezősök Félévek Linkek * kalendárium |
CSharp /
20180405gLINQ's Take() and Skip()We saw list slicing in the previous post, where we used a custom extension. Another way is to use LINQ's csharp> var li = new List<int> {1, 5, 2, 7, 6, 9} csharp> li.Take(2) { 1, 5 } // take the first 2 elements csharp> li.Take(2).GetType() System.Linq.Enumerable+ListPartition`1[System.Int32] csharp> csharp> li.Skip(3) // skip the first 3 elements and take the rest { 7, 6, 9 } csharp> li.Skip(2).Take(2) { 2, 7 } csharp> |
Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |