forked from dotnet/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenum-statement_6.vb
More file actions
31 lines (26 loc) · 953 Bytes
/
Copy pathenum-statement_6.vb
File metadata and controls
31 lines (26 loc) · 953 Bytes
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
' Apply the Flags attribute, which allows an instance
' of the enumeration to have multiple values.
<Flags()> Public Enum FilePermissions As Integer
None = 0
Create = 1
Read = 2
Update = 4
Delete = 8
End Enum
Public Sub ShowBitwiseEnum()
' Declare the non-exclusive enumeration object and
' set it to multiple values.
Dim perm As FilePermissions
perm = FilePermissions.Read Or FilePermissions.Update
' Show the values in the enumeration object.
Console.WriteLine(perm.ToString)
' Output: Read, Update
' Show the total integer value of all values
' in the enumeration object.
Console.WriteLine(CInt(perm))
' Output: 6
' Show whether the enumeration object contains
' the specified flag.
Console.WriteLine(perm.HasFlag(FilePermissions.Update))
' Output: True
End Sub