/EnumExtensions

C# Custom Attributes and Enum Extensions

Primary LanguageC#

EnumExtensions

C# Custom Attributes and Enum Extensions

Primarily been a Java programmer when I started learning C# for a new company project I found my self hitting the wall as some of the most basic Enum features are not available out of the box compared to Java Enum which is basically a full fledged class thus enabling you to extended easily by applying OOP principles. This is not the case for C#, This project will serve to illustrate ways to bridge the gap and hopefully achieve the same functionality as Java Enums.

Enum features covered

  • Extending Enums using Custom attributes
  • Replicating Java Enum.values() method via extension method
  • Coverting enums to string and back to original enum to assist in saving them as a string using EF 6.0