.NET Framework Bookmark and Share   
 index > Network Class Library (System.Net) > how can i convert string to ProtocolType?
 

how can i convert string to ProtocolType?

hi all

how can i convert string to ProtocolType?
Thanks Motevallizadeh
motevallizadeh
Use following code

Dim protocol As ProtocolType
protocol  = [Enum].Parse(GetType(ProtocolType), "Tcp")

Above code will convert "Tcp" string to ProtocolType.Tcp. Similar you can use for others.


Gaurav Khanna
Khanna Gaurav
The equivilent C# code:

ProtocolType typ = Enum.Parse(typeof(ProtocolType), "Tcp");

Ali A G
Use following code

Dim protocol As ProtocolType
protocol  = [Enum].Parse(GetType(ProtocolType), "Tcp")

Above code will convert "Tcp" string to ProtocolType.Tcp. Similar you can use for others.


Gaurav Khanna
Khanna Gaurav
The equivilent C# code:

ProtocolType typ = Enum.Parse(typeof(ProtocolType), "Tcp");

Ali A G

You can use google to search for other answers

Custom Search

More Threads

• How to route client to a server with an unknown IP on a LAN
• tcp listening question
• UDP Multicast Dgram size question
• FTPES - FTP through Explicit TLS/SSL
• SSL/TLS, The handshake failed due to an unexpected packet format. Mercury for Win32. POP3
• Sending signed and encrypted S/MIME (PKCS 7) mail with .net
• Socket programming in Web services
• SSL with Socket connection.
• problem with catching DNS udp packets
• How can i do a POST request faster (httpWebRequest, VB.NET)