Josh Fischer - .NET and C# Consultant

.NET, C#, Azure, WinUI, Wpf, Uno, Sql, Visual Studio, Webassembly

Enum Values Can Be Duplicated and Negative

- Posted in .NET by

Well, you learn something every day. I just discovered that .NET enumerations can have duplicate values. I personally think this is little dangerous as the primary use of enumerations is to provide discrete numerical values for text based names, but I can image there are edge cases in which it comes in handy. The same is true for negative values, which I did know about. Sometimes it is useful to just cast an enum value to the final value you want instead of starting at zero and doing the subtraction every time.

enter image description here