Say I have 3 char variables, a, b and c.
Each one can be '0', which is a special case and means it matches every char.
So if a is '0', I only need to check if b == c.
I want to check if a == b == c, but found the implementation in C# goes chaotic and lengthy.
Is there any creative or pretty solution you can offer?
update
for performance driven, take Erik A. Brandstadmoen’s approach.
for simplicity, use M4N’s apprach, also i did some modification: !(query.Any() && query.Distinct().Skip(1).Any())
Something like this should work for any number of char values:
Passes the following unit tests: