Question: In my project there is an UI which contains a combobox and the combobox will list some communication protocol, such as TCP/IP, FTP and so on

I want to use an enum to present the communication protocols, maybe like this:

```
public enum CommuProtocol 
{
   TCPIP = 0,
   FTP,
   MPI,
   Other
}

```

so, how to bind the enum value to the text in combobox. For example, from the text selected in combobox I can easily know the corresponding enum value and vice versa. And I hope that will be easy to be extended in the future.

**The text maybe not the same with the enum value, etc, TCP/IP vs TCPIP...**

Thanks!

Answer: 
Well, either you make a function which translates the values into strings or you [ToString](http://msdn.microsoft.com/en-us/library/16c1xs4z.aspx) the value:

```
CommuProtocol prot = CommuProtocol.FTP;
string name = prot.ToString();

```

You can use the name of the enum member to get a proper value with the [parse member of Enum](http://msdn.microsoft.com/en-us/library/essfb559.aspx):

```
CommuProtocol prot = System.Enum.Parse(CommuProtocol, "FTP");

```

However, since the names of the members might not be suitable for display it's possible that you'll end up making a method that translates the names anyway.
You should go with [`Enum.GetValues()`](http://msdn.microsoft.com/en-us/library/system.enum.getvalues.aspx) method. Here is an example: [How do you bind an Enum to a DropDownList control in ASP.NET?](https://stackoverflow.com/questions/61953/how-do-you-bind-an-enum-to-a-dropdownlist-control-in-asp-net)