I'm using C#.
So I have an object which has some fields, doesn't really matter what. I have a generic list of these objects.
List<MyObject> myObjects = new List<MyObject>();
myObjects.Add(myObject1);
myObjects.Add(myObject2);
myObjects.Add(myObject3);
So I want to remove objects from my list based on some criteria.
For instance, myObject.X >= 10.
I would like to use the RemoveAll(Predicate<T> match)
method for to do this.
I know I can define a delegate which can be passed into RemoveAll, but I would like to know how to define this inline with an anonymous delegate, instead of creating a bunch of delegate functions which are only used in once place.