The LINQ RemoveAll call

Another rinky dink LINQ issue. I needed to remove some items from a collection, and lo, I wanted to do it with LINQ because ladies love LINQ experts – that’s just how it is.

So I have my collection of objects:

     List<Order> OrderItems = DBClass.GetStuff(CustomerId);

And I use the handy dandy RemoveAll function to heartlessly delete all records matching the Status field of my Order class:

     OrderItems.RemoveAll(item => item.Status == "Approved");

Am I the only one who feels cool when they do LINQ stuff? I need to get out more.

Advertisements
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: