Friday July 31st

Thursday July 30th

Wednesday July 29th

0 Kicks

Finding missing numbers in a list using LINQ with C#

Let’s say you have a list of integer values that represent the days of a month like this: 6, 2, 4, 1, 9, 7, 3, 10, 13, 15, 19, 11, 18, 13, 22, 24, 20, 27, 31, 25, 28 - Clearly we have missing numbers/days in the list. They are: 5 8 12 14 16 17 21 23 26 29 30. It’s really easy to get a list of missing numbers using LINQ with C# and the Except operator. LINQ is the greatest addition to the C# language. I can imagine how life would be difficult if we hadn’t LINQ! This post shows how I implemented a missing numbers finder using a C# extension method.

0 comments

Commenting on Stories is limited for now and will open up to those recommended by the community. Learn how
Loading DotNetKicks...
brought to you by the Kicks Network