Tip/Trick: Building a ToJSON() Extension Method using .NET 3.5
page 1 of 5
Published: 01 Oct 2007
Unedited - Community Contributed
This article examines how to build a ToJSON() Extension Method using .NET 3.5.
by Scott Guthrie
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 21908/ 30


Republished with Permission - Original Article

Earlier this year I blogged about a new language extensibility feature of C# and VB called "Extension Methods". 

Extension methods allow developers to add new methods to the public contract of an existing CLR type, without having to sub-class it or recompile the original type.  In doing so they enable a variety of useful scenarios (including LINQ).  They also provide a really convenient way to add a dash of "syntactic sugar" into your code.

Over the last few months I've been making a list of cool extension methods that I plan to sit down and implement when I get some free time (not sure when that is... but at least I can still have fun coming up with the ideas!)  Two of the scenarios I added to my extension method list were easy methods to automate generating JSON (JavaScript Object Notation) or XML serialization strings for any .NET object. 

View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-06-23 7:37:02 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search