For example:
(1).SomeFunction().Equals("one")
(2).SomeFunction().Equals("two")
I really only need it for digits 1-9 in the case I’m working with, should I just use a switch/select case?
Update I won’t need localization in this case either.
Update 2 Here’s what I ended up using:
Private Enum EnglishDigit As Integer
zero
one
two
three
four
five
six
seven
eight
nine
End Enum
(CType(someIntThatIsLessThanTen, EnglishDigit)).ToString()
How about an enumeration?
Then you can type things like…
If you need localization then you can add a
DescriptionAttributeto each enum value. The attribute’sDescriptionproperty would store the name of the resourse item’s key.The following function will grab the value of the
Descriptionproperty from the attributeThis can be called in the following manner:
From that you can then pull the relevant value from the resource file, or just call
.ToString()ifnullwas returned.Edit
Various commenters have pointed out (and I have to agree) that it would be simpler to just use the enum value names to reference localised strings.