In C#, is it possible to decorate an Enum type with an attribute or do something else to specify what the default value should be, without having the change the values? The
enum Orientations
{
None, North, East, South, West
}
private Orientations? _orientation { get; set; }
public Orientations? Orientation
{
get
{
return _orientation ?? Orientations.None;
}
set
{
_orientation = value;
}
}
If you set the property to null will return Orientations.None on get. The property _orientation is null by default.