Vb.net 创建在.NET中返回字符串(enum返回int)的枚举或等效枚举
我有一个URL,比如说Vb.net 创建在.NET中返回字符串(enum返回int)的枚举或等效枚举,vb.net,string,enums,Vb.net,String,Enums,我有一个URL,比如说http://www.example.com。有时候,我需要发送HTTP,有时候,我需要发送HTTPS。为此,我创建了一个枚举: Private _protocol As Protocol Enum Protocol HTTP HTTPS End Enum Public Property protocolType() As Protocol Get Return _protocol End Get Set(ByVa
http://www.example.com
。有时候,我需要发送HTTP,有时候,我需要发送HTTPS。为此,我创建了一个枚举:
Private _protocol As Protocol
Enum Protocol
HTTP
HTTPS
End Enum
Public Property protocolType() As Protocol
Get
Return _protocol
End Get
Set(ByVal value As Protocol)
_protocol = value
End Set
End Property
现在,当我从protocoltype返回值时,它返回一个整数值作为enum。如何获取枚举的字符串名称
Dim targetUri As String = setting.protocolType & "://www.example.com"
要获取枚举的字符串值,请使用Thank lot。我想它会把像2到2的int转换成string(int)