Take a look at these c++ codes :
enum class Flag : int32 {
f_unread = (1 << 0),
f_out = (1 << 1),
f_mentioned = (1 << 4),
MAX_FIELD = (1 << 4),
};
What is the covert of those codes in c#?
Take a look at these c++ codes :
enum class Flag : int32 {
f_unread = (1 << 0),
f_out = (1 << 1),
f_mentioned = (1 << 4),
MAX_FIELD = (1 << 4),
};
What is the covert of those codes in c#?
Using Tangible. Seems like it is not far different.
In c#, to use
enum
as bit field for flags operation, it should be added withFlagsAttribute
, which adds[FlagsAttribute]
or[Flags]
before theenum
.