The enumeration in C# lets the developers to define a limited set of known values.
For example , I can define an enum called Designation as shown below use it in the application.
enum Designation
{
Trainee=1,
SoftwareEngineer = 2,
Consultant=3
};
Now , Can i assign duplicate values to enum items ?
Is this Possible with Enum in C# ?
Yes , it is possible to assign duplicate values to the enumeration items . For example , imagine a scenario where Software Engineers and Consultants needs to have the same value say 2 , below is a code snippet to demonstrate it.
enum Designation
{
Trainee=1,
SoftwareEngineer = 2,
Consultant=2
};