Is there a way of shortening if(a=="bcd" || a=="efg")?
Because the conditions are both on a It would be nice to write something like if(a=="bcd"||"efg") and contract the statement. I know I could write something custom to handle it, but was wondering if there is anything built into C# that would accomplish it?
With C# 9's patterns, you can write:
if (a is "bcd" or "efg")
{
}