I want to pass a method around and store it. Let’s say the method takes one int and returns void. I’d wrap it in Action< int >.
Now, is there a way to invoke that method but not on the object it originated from but a different instance of the same class?
It’s kind of hard to be more specific than that but please ask if anything is confusing and I’ll try again.
EDIT: Okay, ignore my first attempt. I thought you were talking about a different class.
It sounds like you should actually be wrapping the method in an
Action<object, int>(or a more strongly typed version).Alternatively, you could create a new delegate using: