Here are the methods covered so far.
- Part 1 〰️ Select, Aggregate, Where, OrderBy (Ascending, Descending)
- Part 2 〰️ Any, Distinct, Concat, SelectMany
- Part 3 〰️ Reverse, Zip, Min/Max
- Part 4 〰️ Union, Intersect, Except
- Part 5 〰️ Sum, Average, Count
- Part 6 〰️ First, Last, DefaultIfEmpty, Skip, Take
- Part 7 〰️ Empty, Repeat, Range
- Part 8 〰️ All, Contains, SequenceEqual
In this article, I will cover following methods.
|Empty|| - An empty array||Empty|
I won’t be using
Orders collections as I have in previous articles.
.Empty returns a typed sequence but since there is no need for a type, you can just return an empty array
Nothing surprising as shown above 😀.
For this demo, I thought it was an overkill to use Orders collection used in last 6 articles so simply repeated a sentence, “I love your smile” five times.
Same here with the Repeat Demo, I will use a simple case to demo how to generate a range of numbers.
I used he same technique but utilizing an index property of map callback, which is where initialization of a range occurs (index starts from 0).
🔴 Closing Remark
It’s because many LINQ methods are simply a syntactic sugar over what “map” and “reduce” can do.
Please let me know should you find any errors or improvements I can make to the codes.
The full source code and instructions on how to run them are on GitHub.