Skip to main content

What is an enum?

Junior C#
Quick Answer An enum is a named set of integer constants. Instead of magic numbers like 1=Active, 2=Inactive, you write Status.Active and Status.Inactive. Makes code readable and less error-prone. Under the hood, each value maps to an int starting at 0 by default.

Answer

An enum is a special value type that represents a set of named constant values.

It improves readability when working with predefined options, categories, or states.

S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice