This has been asked before (I think), but looking through the previous answers I still haven't been able to figure out what I need.
Lets say I have a private method like:
private void GenericMethod<T, U>(T obj, U parm1)
Which I can use like so:
GenericMethod("test", 1);
GenericMethod(42, "hello world!");
GenericMethod(1.2345, "etc.");
How can I then pass my GenericMethod
to another method so that I can then call it in that method in a similar way? e.g.:
AnotherMethod("something", GenericMethod);
...
public void AnotherMethod(string parm1, Action<what goes here?> method)
{
method("test", 1);
method(42, "hello world!");
method(1.2345, "etc.");
}
I just can't get my head around this! What do I need to specify as the generic parameters to Action
in AnotherMethod
?!