July 17th, 2013, 02:44 PM
Information on the Where keyword.
I've only been doing C# for a few days, and I'm working on a simple console application. The user can insert details to create elements, edit elements, delete elements, and now sort them. /edit - This is going to make a colon delimited file that will be used in a future project.
I have no formal education on C#, or object oriented programming, so I apologize if this seems elementary. I browsed the internet, looking at how to sort a List<T> full of element objects based on a certain field. I found the answer, and once adapted, here it is:
What is the '.Where' keyword? Does anyone have any links to information on this? It seems very convenient and I would like to learn more about it if possible.
foreach (Element o in elementList.Where(Element => Element.gAtomicNumber == Convert.ToInt32(str)).ToArray())
Thanks for any advice!
Click Here to Expand Forum to Full Width