C#

C#

Made by DeepSource

Argument passed to Enum.HasFlag should be same as the type on which it is being invoked CS-W1055

Bug risk
Critical

The HasFlag method determines if one or more bit fields are set for the specified enum. However, the argument that is passed to this method should be of the same type as that of the enum on which this method is being invoked. Failing to provide proper argument may result in incorrect results.

Bad Practice

fooEnum.HasFlag(Bar.Baz);

Recommended

fooEnum.HasFlag(Foo.Buzz);

Reference