Geeks With Blogs

News

Len Smith's Facebook profile


nIgnuSharp.NET //len smith is a software developer in ann arbor, mi

Here's my new favorite:

public static string AppSetting(this string parameter) { return System.Configuration.ConfigurationManager.AppSettings[parameter]; }

Now I can simply call

"BaseUrl".AppSetting();

 

Beautiful.

Posted on Thursday, November 6, 2008 7:00 AM | Back to top


Comments on this post: Have I mentioned loving Extension Methods?

# re: Have I mentioned loving Extension Methods?
Requesting Gravatar...
hmmm..

I think this is great but this makes the code a lot more confusing. The function on the above example doesn't seem to give a clear intent on what it is doing when converted into an extension method.

just my 2 cents.
Left by Keith Rull on Nov 06, 2008 12:47 PM

Your comment:
 (will show your gravatar)


Copyright © Len Smith | Powered by: GeeksWithBlogs.net