Finding missing numbers in a list using LINQ with C# (www.leniel.net)
submitted by
leniel(415) 3 months, 28 days ago
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.
read more...
|
category: Linq
|
Views: 13
tags:
LINQ Programming missing Numbers C# another
Everyones tags:
Your Tags: