-
July 17th, 2013, 01:44 PM
#1
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:
Code:
foreach (Element o in elementList.Where(Element => Element.gAtomicNumber == Convert.ToInt32(str)).ToArray())
{
elementList.Remove(o);
}
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.
Thanks for any advice!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|