[Solved] Escaping a dot in c# [closed]


That’s not how enums work.

You need something like this:

private enum UserAgents
{
    MSIE70,
    MSIE60,
    MSIE50
}

But then you have to worry about getting the string value out of it, the flags don’t match the string representation either. You could decorate them with DescriptionAttributes but then you still have to do all the work to pull the string out.

Best thing to do would be to define a static class UserAgents with public static readonly fields for each user agent type:

public static UserAgents
{
   public static readonly MSIE70 = "MSIE 7.0"; 
   //etc...
}

Then you can do UserAgents.MSIE70 to access the field.

solved Escaping a dot in c# [closed]