In this short video we explore how using extension methods and the CallerMemberNameAttribute can help to reduce duplicate code and remove magic strings from your code
For any and all developers that have an addiction to learning and problem solving I give you (drum roll please) Sleep Can Wait...
Showing posts with label extension methods. Show all posts
Showing posts with label extension methods. Show all posts
Sunday, October 6, 2013
How CallerMemberNameAttribute can help to remove magic strings
In this short video we explore how using extension methods and the CallerMemberNameAttribute can help to reduce duplicate code and remove magic strings from your code
Saturday, June 23, 2012
GetCustomAttributes Sucks
Ok so maybe the title of this post is a little harsh. I don't really have anything against the MemberInfo.GetCustomAttributes. I just don't like writing code like the following:
I'd prefer to do something like this:
Here is the source for the GetAttribute extension method:
I'd prefer to do something like this:
Here is the source for the GetAttribute extension method:
You can download the full source (with tests) on GitHub here.
Subscribe to:
Posts (Atom)