Wednesday, 28 March 2012

ViewModels for Enums

Here is a neat trick for providing a generic view model for your enums:


The DisplayText is looked up from a resource file containing strings for the application. 

There is also a little static helper class for enums, which doesn’t do a lot but I think helps to keep code a little cleaner:

Source code including unit tests:

1 comment: