Job,
Normally when I need character constants I use character constants instead
of an Enum.
Something like:
Public Notinheritable Class Delimiters
Const Tab As Char = ControlChars.Tab
Const Semicolon As char = ";"c
Const Comma As Char = ","c
Const Space As Char = " "c
Private Sub New()
End Sub
End Class
The "Notinheritable" prevents any one from inheriting from this class, the
"Private Sub New" prevents any one from instantiating this class.
NOTE: I normally put the above in the class where they are needed, not in
their own class...
If I "really" needed/wanted an Enum, I would consider using the AscW code of
the characters then use ChrW to get Characters out. However! I would
seriously consider the above constants first!
Something like:
Public Enum Delimiters
Tab = AscW(ControlChars.Tab)
Semicolon = AscW(";"c)
Comma = AscW(","c)
Space = AscW(" "c)
End enum
Dim ch As Char = ChrW(Delimiters.Tab)
Hope this helps
Jay
|I have an enumeration as follows
|
| Public Enum Delimiters
| Tab
| Semicolon
| Comma
| Space
| End Enum
|
| How can I return character equivalent of the elements in the enumeration?
|
| Should I write a Function which checks each element and return character
| equivalent or is there any other way as well?
|
| Thanks
|