I did not want to type this as an answer, because it does not directly answer your question, but based on your comment in response to my comment on your question, it deserves some explanation.
Enumerations should be very simple types of safe state representations. If you just use constants, then you can assign invalid constants to a value. This does not allow you to assign the wrong type of constant to the field. For example, if you have something that DayOfWeek expects, you cannot assign a value to FileAccess, although both of them are constants of the same base type.
DayOfWeek day = FileAccess.Write;
If you need this type of security and you donโt need your enum to display any other type of behavior, then use the enum. If you are concerned that your enum is doing other things (e.g. enumeration, math operations, etc.), you should consider using classes. See my example below.
public class LegalShipTypes { private readonly byte _numericValue; private readonly string _text; private LegalShipTypes(byte numericValue, string text) { _numericValue = numericValue; _text = text; } public byte Value { get { return _numericValue; } } public string Text { get { return _text; } } public static IEnumerable<LegalShipTypes> All { get { return new[] { Frigate, Cruiser, Destroyer, Submarine, AircraftCarrier }; } } public static readonly LegalShipTypes Frigate = new LegalShipTypes(1, "Frigate"); public static readonly LegalShipTypes Cruiser = new LegalShipTypes(2, "Cruiser"); public static readonly LegalShipTypes Destroyer = new LegalShipTypes(3, "Destroyer"); public static readonly LegalShipTypes Submarine = new LegalShipTypes(4, "Submarine"); public static readonly LegalShipTypes AircraftCarrier = new LegalShipTypes(5, "Aircraft Carrier"); }
Now you can use it as a type:
public class Fleet { private readonly List<LegalShipTypes> _ships; public Fleet() { _ships = new List<LegalShipTypes>(); } public LegalShipTypes Flagship { get; set; } public ICollection<LegalShipTypes> Ships { get { return _ships; } } } .... var fleet = new Fleet(); fleet.FlagShip = LegalShipTypes.AircraftCarrier; var iDoNotKnowWhyYouWouldNeedThisBut = LegalShipTypes.All.Sum(ship => ship.Value); Console.WriteLine("The flagship is a(n) \"{0}\".", fleet.FlagShip.Text); if (fleet.FlagShip == LegalShipTypes.AircraftCarrier)
As you can see, you still have type safety, but much more flexibility. This is more code, but you will not work against enumeration restrictions. To repeat, the listing should be simple. It should be easy. If your needs are simple, feel free to use them. If your needs are more complex, there is no shame in using old-fashioned object-oriented programming to solve your problem.
EDIT
In light of your last comment on the response that byte values โโrepresent the number of pegs, I strongly recommend that you not use enums to solve your problem. You would (ironically) try to put a circular anchor in a square hole.