Skip to content

Delegate Invoke

Michael Damatov edited this page Nov 15, 2018 · 2 revisions

Show a suggestion when the Invoke method is used on delegate types.

Quick Fix

  • Remove the Invoke

Example

Action action = ... // not null

action.Invoke(); // redundant "Invoke"

action(); // after applying the quick fix

Exceptions

Action action = null

action?.Invoke(); // "Invoke" is not redundant

💡 The analyzer can be deactivated in the ReSharper Options dialog.