Decreasing value in C# or VB.NET enum

c#, enums, vb.net

Solution

No, it is not possible.

You must declare the values if you wish to do so, or reverse the declaration:

public enum testEnum
{
    other = -3,
    that,
    @this
}

Problem

More for interest than actual need... is it possible to have an automatically decreasing enum in C# or VB.NET? ``` public enum testEnum { this = -1, that, other, } ``` So that that = -2 and other = -3. I'm pretty sure the only way to do it is to specifically assign "that" and "other", but I wondered if there was an automatic way of doing it. Edit To be clear, I'm simply talking about the automatic assignment of the value, not the actual value of the enum decreasing.

Original source