I saw a post recently where Christopher Bennage talks about his little friend, Enum<T>. Christopher said that the code was so simple he was almost ashamed of it. No need to be ashamed dude, the simplest code is the best code! ;)
I thing this is actually an area where Extentions can be used very effectively.
I used ConvertTo as I feel this better describes what we are doing. And it is easy to use:
Love it. What is the source.ArgumentNotNullOrEmpty(“source”) in ConvertTo I hear you ask? Well here is the code for that bit:
This can be used to check if method parameter values are null or if they are strings, null or empty. Another cool extention.