DEV Community

Discussion on: Pattern Matching Examples in C#

Collapse
uchitesting profile image
UchiTesting

Thanks for the fixes.
Tried them and they work.
I must admit that when reading the code this or looked legit.
But when you go back to boolean it makes sense.

TelephoneNumber is null
TelephoneNumber not null → False → 0
TelephoneNumber not "" → True → 1

0 or 1 is 1 so it executes the line.
0 and 1 is 0 so it filters accordingly.

Regards.