Recent Changes - Search:

Oktatás

* Programozás 1
  + feladatsor
  + GitHub oldal

* Szkriptnyelvek
  + feladatsor
  + quick link

Teaching

* Programming 1 (BI)
  ◇ exercises
  ◇ quick link

* Scripting Languages
  ◇ exercises
  ◇ quick link

teaching assets


Félévek

* aktuális (2023/24/2)
* archívum


Linkek

* kalendárium
   - munkaszüneti napok '20
* tételsorok
* jegyzetek
* szakdolgozat / PhD
* ösztöndíjak
* certificates
* C lang.
* C++
* C#
* Clojure
* D lang.
* Java
* Nim
* Scala


[ edit | logout ]
[ sandbox | passwd ]

20180405g

LINQ'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 .Take() and .Skip() methods.

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>
Cloud City

  

Blogjaim, hobbi projektjeim

* The Ubuntu Incident
* Python Adventures
* @GitHub
* heroku
* extra
* haladó Python
* YouTube listák


Debrecen | la France


[ edit ]

Edit - History - Print *** Report - Recent Changes - Search
Page last modified on 2018 April 05, 18:10