February 18, 2013

Enum: the ‘simple’ C# value type we love to complicate

Filed under: Development — Tags: , , , , , — Arne Joris @ 12:20 pm

Enums are simple collections of constant values, using an underlying integer to store the value.  Enums implement IComparable, IFormattable and IConvertible while still being value types and give us everything we need to store and use things like status values, action codes, colours etc…

You can use enum values in both server and client code, but when the user interface displays an enum, or when the user must be able to choose enums from a combobox, we can run into complications with enums. Making enum display values more human readable and showing values in a particular order are not that easy to implement. In this article, I will show you a solution used in a WPF client consuming WCF web services.

(more…)

Powered by WordPress

Switch to our mobile site