Is it possible to have a switch in a lambda expression? If not, why? Resharper displays it as an error.
Yes, it works, but you have to put your code in a block. Example:
private bool DoSomething(Func callback) { return callback("FOO"); }
Then, to call it:
DoSomething(val => { switch (val) { case "Foo": return true; default: return false; } });