NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.
A more complicated LINQ query would be more suited to select a specific subset of data based on some predicate, but for this, it's better to keep it simple, as suggested above.
Alternatively you could do something like this:
Nodes max = Population.Max();
Nodes min = Population.Min();
Nodes nextToMin = Population.Min();
This way you can avoid sorting, and if you need to perserve the original structure of the list, you can put the min back in. Wow, it rimes!
Aside from that, it's a good idea to try and make your code comply with widespread C# naming conventions - local variables such as Population should use camelCasing, so I would rename that to population instead.
These conventions help both you and us (or any potential team members in a team project) understand the code more quickly. Besides, if you give this application a rest, and then come back some time, you'll be quicker to pick up where you left of if your naming conventions are consistent throughout your work.
I normally use camelCase, I often just write sample code segments, in my forum posts. However, Thanks for the help with that quick snippet, didn't even think about that. LINQ is seeming to be quite helpful. Just started learning it this week.
Last edited by QuinnJohns; October 10th, 2011 at 10:58 PM.