I d like to declare an "empty" lambda expression that does, well, nothing.
Is there a way to do something like this without needing the DoNothing()
method?
public MyViewModel()
{
SomeMenuCommand = new RelayCommand(
x => DoNothing(),
x => CanSomeMenuCommandExecute());
}
private void DoNothing()
{
}
private bool CanSomeMenuCommandExecute()
{
// this depends on my mood
}
My intent in doing this is only control the enabled/disabled state of my WPF command, but that s an aside. Maybe it s just too early in the morning for me, but I imagine there must be a way to just declare the x => DoNothing()
lambda expression in some way like this to accomplish the same thing:
SomeMenuCommand = new RelayCommand(
x => (),
x => CanSomeMenuCommandExecute());
Is there some way to do this? It just seems unnecessary to need a do-nothing method.