InternetException

enums

enums · 1 post (all tags)

Safe cast string to enum

· 1039 words · ~5 min read · updated · in .NET, C#

#enums

In on of my projects I had make an interface between database and web service in C# code. One of problem I had to face was need to cast strings to enumerable types, because of simple fact that database have no idea what is an ’enum’. Yes simplest mapping between an enumeration and database type is integer. It is simplest but in my idea not best. For example I really do not remember (or do not WANT to remember) what is the meaning of 4 integer value in case of package shipment status.

Read the whole thing →