Incorrect Ambiguous invocation

I have the following 2 helper methods:

public static U IfNotNull<T, U>( this T instance, Func func) where T : class { Argument.NotNull("func", func); return instance != null ? func(instance) : default(U); } public static void IfNotNull]]>( this T instance, Action action) where T : class { Argument.NotNull("action", action); if (instance != null) { action(instance); } } When trying to use the one with the Action]]> call resharper says it can also use the Func one with the second argument as void, but then complains that void can't be used, the code compiles fine though, for now I specify the generic part myself to resharper knows which one to use.

1 comment
Comment actions Permalink


We appreciate your feedback. The corresponding JIRA request has been created,
and you are welcome to monitor its status at

You may want to check our request tracking policy here:

Best regards,
- Development Team.


Please sign in to leave a comment.