Question

Edit: It is my own mistake (combined with some unexpected changes outside). please ignore this post and sorry for inconvenience!

Before I used to just pass this method:

string DoSomething(string)

Now the vendor added another overload like void DoSomething(string, string). I tried to pass the method as a parameter but the compiler complains it cannot convert the method group, which makes sense I guess since DoSomething now has 2 signatures.

The question is, how do I pass just one signature?

Était-ce utile?

La solution

I believe you should define your parameters as either Action<string> or Action<string, string> depending on which method you wish to call.

The Action<T> Delegate

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top