I want to be able to declare a static list of strings in VB.NET like this:
Public Class AccessTypes
Public Shared ViewRights As String = "viewrights"
Public Shared EditRights As String = "editrights"
End Class
Then, in a function I want to pass AccessType as a parameter like this:
Public Shared Function CheckAccess(ByVal AccessType As String) As Boolean
'-- check access code
'-- return true/false
End Function
When checking access, I can pass:
CheckAccess(AccessTypes.ViewRights)
but I can also pass:
CheckAccess("randomstring")
Is there a way that I can only pass one of the members of AccessType Class and not just any random string.
I know there is something terribly wrong with the above code. Any advise would be helpful.