Take is LINQ functionality to get given number of elements from the beginning of a collection. Below you can find out how to use it.
We’ll start with creating example list of colors:
Let’s say we want to get first three items, so need to call Take with parameter 3.
Now print the received collection to the console:
Result:
When we print on screen original list, it stays unchanged:
Result:
Need Help with Your C# Projects?
We offer expert support and development services for projects of any size. Contact us for a free consultation and see how we can help you succeed.
CONTACT US NOW