I’d like to do something like the following in C#:
class Container { //... public void ForEach(Action method) { foreach (MyClass myObj in sequence) myObj.method(); } } //... containerObj.ForEach(MyClass.Method);
In C++ I would use something like std::mem_fun. How would I do it in C#?
This ought to work, in C# 3.0: