-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEnum.cs
50 lines (42 loc) · 912 Bytes
/
Enum.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
public class Account
{
[Flags]
public enum Access
{
Delete = 1,
Publish = 1 << 1,
Submit = 1 << 2,
Comment = 1 << 3,
Modify = 1 << 4,
Editor = Delete | Publish | Comment,
Writer = Submit | Modify,
Owner = Editor | Writer
}
public static void Main(string[] args)
{
Console.WriteLine(Access.Writer.HasFlag(Access.Delete)); //Should print: "False"
}
}
/*
using System;
public class Account
{
[Flags]
public enum Access
{
Delete = 1,
Publish = 2,
Submit = 4,
Comment = 8,
Modify = 16,
Editor = 11,
Writer = 20,
Owner = 31
}
public static void Main(string[] args)
{
Console.WriteLine(Access.Writer.HasFlag(Access.Delete)); //Should print: "False"
}
}
*/