I\'m curious to know why the C# compiler only gives me an error message for the second if statement.
enum Permissions : ulong
{
ViewListItems = 1L,
}
pu
It's not the CLR giving this error message it's the compiler.
In your first example the compiler treats 32
as ulong
(or a type that's implicitly convertible to ulong
eg uint
) whereas in your second example you've explicitly declared the type as an int
. There is no overload of the >
operator that accepts an ulong
and an int
and hence you get a compiler error.