views:

68

answers:

1

i have a URL lets say . some time i need to send HTTP and some time i need to send it to HTTPS for that i created a enum:

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

now when i get value back from protocoltype it returns me integer value as enum do so tell me how to get string from enum or other substitute.

 Dim targetUri As String = setting.protocolType & "://www.mysite.com"
+2  A: 

To get the string value of the Enum, use Enum.ToString()

Gabriel McAdams
Thanks lot. i thought it will convert like 2 to "2" int to string(int)
Rajesh Rolen- DotNet Developer