class Citizen
{
public Citizen()
{
//……
}
public string ID { get; set; }
public string Name { get; set; }
public string Gender { get; set; }
public int Age { get; set; }
public string Birthplace { get; set; }
public string Familyaddress { get; set; }
枚举适用于分类,比方说车,可以分为小汽车,卡车,货车,火车等等,这些可以用枚举。你这个例子中的属性不是同一类别,不建议使用枚举,强行使用会很难受
public enum Citizen {
ID("ID"),
Name("Name"),
Gender("Gender"),
Age("Age"),
Birthplace("Birthplace"),
Familyaddress("Familyaddress");
public final String value;
Citizen(String value) {
this.value = value;
}
}