I came across some Enumerators that inherited uint. I couldn’t figure out why anyone would do this.
Example:
Enum myEnum : uint { ... }
Any advantage or specific reason someone would do this? Why not just leave it as defaultint?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One reason I can think of is that range checking is easier. Given that most enumerations start at 0, you’d only have to check the upper bound.