The documentation is not clear on what the actual behavior is, so I looked at the source code for Enum.Parse
(in .NET 4.5). It will always use an invariant culture (not the current culture) when parsing integer values from the input string. Specifically the line to parse the integer is:
temp = Convert.ChangeType(value, underlyingType, CultureInfo.InvariantCulture);
Numeric values are identified by checking if the first character is a digit (using Char.IsDigit
), '+'
, or '-'
. So you would be safe if you convert to a string using the invariant culture on the client and use Enum.Parse
on the server and they both use .NET 4.5. However, I'm not sure as to whether this is the behavior on older versions of the framework or is guaranteed for future versions.