Retirement Funds

Good Explanation of Extension Methods

Found a good explanation of extension methods in .Net 3.0 on MSDN today.  It looks like a pretty easy way of extending your code in an intuitive fashion.

Case in Point:  You have a 3rd party set of objects, and you want to send them out across the web to your page as Json strings, and it would be really nice to have it be as easy as ... MyObject.ToJSON();  If MyObject() doesn't have that func, you're s.o.l.; at least you were.  Now you can write a static method that will extend MyObject() to include a ToJSON() method which will return a string.  How cool is that?  Go read about it.

By hank on 13. December 2007 02:43 | Comments (0)


Add comment


 

  Country flag

biuquote
  • Comment
  • Preview
Loading