What syntax exists in C# to help with multiple condition testing?
I often have to test for multiple conditions in the following manner:
if (a == 3 || a == 4)
Perhaps I'm being subjective, but that isn't very pretty.
If there is a larger set of conditions, I could do:
if (new int[]{3, 4, 5, 6, 7}.Contains(a))
But if there are just a few conditions to test, I'm not saving any keystrokes.
Is there a syntax shortcut in the C# language that would allow me to accomplish something like the following, without many keystrokes and without extension methods, etc?
// doesn't work
if (a == 3 || 4)
This is different from this SO thread, because it is dealing with short conditions (2 or 3), all with an unchanging "a" value in an "a compare to b" comparison.