This is what Enum
does. It acts as a front for int
type (or other numeric type when specified). Since N
is first and IC
is second, they respectively are assigned int
values 0 and 1.
My advice: constants will be best suited for what you're trying to achieve.
Public Shared Class StatusCode
Public Const N As String = "N"
Public Const IC As String = "IC"
End Class
' ...
oBLL.StatusCode = StatusCode.N
If however you insist on using enum, you can get the string representation this way:
oBLL.StatusCode = Enum.GetName(StatusCode.GetType(), StatusCode.N)
Note however that obtaining this value at runtime implies reflection, which should be avoided.