If you are trying to write straightforward, yet forbidden code like this:
public class Person
{
public enum Gender
{
Male,
Female
}
//Won't compile: auto-property has same name as enum
public Gender Gender { get; set; }
}
Your options are:
Ignore the MS recommendation and use a prefix or suffix on the enum name:
public class Person
{
public enum GenderEnum
{
Male,
Female
}
public GenderEnum Gender { get; set; }
}
Move the enum definition outside the class, preferably into another class. Here is an easy solution to the above:
public class Characteristics
{
public enum Gender
{
Male,
Female
}
}
public class Person
{
public Characteristics.Gender Gender { get; set; }
}