Skip to content

Instantly share code, notes, and snippets.

Created October 23, 2019 05:39
What would you like to do?
public class ActionCommand : ICommand
private readonly Action<object> _invokedAction;
public ActionCommand(Action invokedAction)
_invokedAction = _ => invokedAction?.Invoke();
public ActionCommand(Action<object> invokedAction)
_invokedAction = invokedAction;
public bool CanExecute(object parameter) => true;
public void Execute(object parameter) => _invokedAction?.Invoke(parameter);
public event EventHandler CanExecuteChanged;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment