I have a project in Vb.net and windows form application with dotnet framework 3.5. I am using Emum for storing and processing tasks As :
Public Enum TaskStatus
none = 0
completed = 2
executing = 4
executed = 8
errors = 16 '' Means task got some error in performing some operations
uploaded = 32
incomplete = 64 '' Means Task Was Aborted or Process Stopped in between
End Enum
One function is processing the task and the other one is Checking its completion status, as
Private Function Manage()
Dim ts As TaskStatus = TaskStatus.none
'' Performing Tasks
ts = TaskStatus.executing
'' Task Performed with Error
ts = TaskStatus.errors Or TaskStatus.executed
'' Task Uploading
ts = ts Or TaskStatus.uploaded
ts = ts Or TaskStatus.completed
ts = TaskStatus.none
CheckStatus(ts)
End Function
Private Function CheckStatus(ByVal ts As TaskStatus)
' Now i Want to check
If ts And (TaskStatus.uploaded Or TaskStatus.errors) Then
'' Which one of these(Below) is Correct
End If
If ts = (TaskStatus.uploaded Or TaskStatus.errors) Then
'' Which one of these(Above one) is Correct
End If
If ts And TaskStatus.incomplete Then
'' Is it Correct way to check for incompletion
End If
If ts And TaskStatus.completed Then
'' Task is Completed
'' Is is correct way to check Task Completed
End If
End Function
In the Function CheckStatus, i want to know the correct way to manipulate with enum
combinations?