Click here to Skip to main content
15,886,110 members
Articles / Programming Languages / C#

Enumeration Types do not Enumerate! Working around .NET and Language Limitations

Rate me:
Please Sign up or sign in to vote.
4.95/5 (74 votes)
10 Mar 2017CPOL31 min read 247.9K   641   111  
Generic classes for enumeration-based iteration and array indexing
namespace EnumerationDemo {

    enum NamingTest { One, Two, Three, Four, Count = One, }

    enum Status {
        Created = 0,
        Started = 1,
        Running = 2,
        Paused = 3,
        Terminated = 4,
        Invalid = 5,
        Deleted = 6,
        [SA.Universal.Enumerations.NonEnumerable]
        Redundant = 100,
        [SA.Universal.Enumerations.NonEnumerable]
        NonUnique = Paused,
        NonUniqueUsable = Running,
    } //enum Status

    enum CardSuit { Clubs, Diamonds, Spades, Hearts, }

} //namespace EnumerationDemo

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
United States United States
Physics, physical and quantum optics, mathematics, computer science, control systems for manufacturing, diagnostics, testing, and research, theory of music, musical instruments… Contact me: https://www.SAKryukov.org

Comments and Discussions