I have a class in VB with some constants that represent the string name of my security roles. I need to be able to call a function to return to me a string array(or collection, or whatever) of the values of each of these constants. I will be using it to make sure that my databases Roles table has the same roles as coded into the application.
Public Class Roles
Public Const Administrator = "Administrator"
Public Const BasicUser = "Basic User"
Public Const PowerUser = "Power User"
End Class
I'm looking to run a function, i.e. ClassConstantsToStringArray(gettype(Roles)) that will return to me "Administrator","Basic User","Power User"
I'm know reflection is the way to go, I just don't know enough about using it yet to get what I want. I found a function on the net that would return to me the constant names in a FieldInfo array but still don't have enough smarts to make that work for me.
Thanks.