我(显然是错误的)假设这Cstr(something)
相当于something.ToString
.
我想将枚举类型作为字符串保存,似乎取决于我使用的转换方法,我要么得到索引,要么得到enum
名称:
Public Enum vehicleType
Car
Lorry
Bicycle
End Enum
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox("Index is " & _
CStr(vehicleType.Car) & _
".Name is " & _
vehicleType.Car.ToString)
End Sub
End Class
为什么这些到字符串的转换会返回该enum
类型的不同元素?