Given this enum:
[Flags]
public enum Result
{
None = 0,
Draw = 1 << 0,
Win = 1 << 1,
Loss = 1 << 2,
NotLost = Draw | Win,
NotWon = Draw | Loss,
Any = Draw | Win | Loss
}
and this class:
public class Match
{
public Result Result { get; }
...
}
How can I get a list of object Match
where property Result
has the flag NotWon
out of a List<Match> matches
?
I've tried matches.FindAll(m => m.Result.HasFlag(Result.NotWon));
but it's always empty, while matches.FindAll(m => m.Result.HasFlag(Result.Loss));
works as intended.