[C#] what is the default value for enum variable


I think it's quite dangerous to rely on the order of the values in a enum and to assume that the first is always the default. This would be good practice if you are concerned about protecting the default value.

enum E
    Foo = 0, Bar, Baz, Quux

Otherwise, all it takes is a careless refactor of the order and you've got a completely different default.


An enum variable, anyone know if it is always defaulting to the first element?