c# - List<object>.RemoveAll - How to create an appropriate Predicate -


It's a little bit of a non-question - I'm still quite new to C # and generic and completely new to the future, the representative and lambda quote ...

I have a class " Inquiries "in which there is a general list of another category called 'vehicle'. I am creating code for adding / editing / deleting vehicles with parents' inquiries. And at the moment, I'm especially looking at extinction.

What I've read so far seems like I can use the vehicles. RemovalAll () A particular vehicle id or all items with a special inquiry to understand my problem is how to feed. The correct lesson of the summation - the examples I have seen are very simple (or maybe I'm very simple, Predictors, representatives and Lambda are given due to lack of knowledge).

If I have list & lt; Vehicles and gt; Vehicle where each vehicle had invoice , how do I use the vehicles. To remove all vehicles for any injection.

I understand that there are many approaches to this, so I am eager to hear the difference between the attitude - as much as I need to do some work, there is also a learning curve.

As a complementary question, is the most common repository for these items? My first inclination was towards a collection, but it appears that I am out of time. Of course, generics are given priority, but I'm curious about other options.

remove all () methods one accept> T & gt; Delegate (even nothing new). Of course, a predictive point which gives only right or wrong returns, of course, remove Remove Remove from the collection all T will be true with reality which is true with reality.

Use the C # 3.0 Developer to pass a bill to Remove all the methods (and not only this one ...) to several methods. You can use:

Lambda Expression

  vehicles.RemoveAll (Vehicle = & gt; Vehicle.InquiryID == 123);  

Unmanned methods

  vehicles. Remove (Rep (Vehicle V) {return v.EnquiryID == 1;});  

General methods

  vehicles. Remove All (Vehicle Custom Advanced); Private Static Bull VehicleCustomPrint (Vehicle V) {return v.EnquiryID == 1; }  

Comments