I have a class A which holds a collection of objects. Every instance of the class fills the collection according a different logic. From time to time I need to update all the collections.
I was thinking this could be done maybe if the class has a method that holds the logic for filling the collection and I can set this logic at the time of the creation of the object.
Like this:
MyClass instance = new MyClass();
instance.updateCollection = { logic for filling the collection } //
The logic will be different for each object.
Thanks
You can achieve this easily with an Action.
Either pass yor desired
Actionin the constructor, or make a property that allows you to set the desiredAction.