我有一个这样的课程:
public class BabyChangeFacility
{
public int Id { get; set; }
public string Name { get; set; }
public ChangeFacilityType Type { get; set; }
public OpeningHours OpeningHours { get; set; }
public LatLng Coordinates { get; set; }
public string Notes { get; set; }
}
我希望ChangeFacilityType
和OpeningHours
成为某种形式的枚举类型,即它们的值应该是预定义的 - 例如我希望ChangeFacilityType
具有以下任一字符串值:
Female Only
Male and Female
OpeningHours
同样具有以下值:
Shop opening hours
Daylight hours
等
定义它们的最佳方法是什么?我最初考虑过使用enum
,但据我所知,它们不能代表字符串值,所以我有点不知道怎么做 - 有人可以帮忙吗?