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.
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
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With