Implementing Extension Methods in C# (
Page 3 of 3 )
Summary
Extension methods are a fascinating and new aspect of .NET programming. Extension methods permit extending the behaviors of classes without inheritance which in some cases is impossible. For example, sealed classes cannot be inherited from. In this article a simple extension method that dumps an object’s state and another generic extension method that extends IDataReader were demonstrated.
ADVERTISEMENT
On a side note extension methods are at the heart of the new technology, LINQ. Extension methods are the underpinnings for the ability to query enumerable objects. Check out my book LINQ Unleashed: for C# for a comprehensive examination of extension methods and LINQ.
Biography
Paul Kimmel is the VB Today columnist for HYPERLINK "http://www.codeguru.com/" \t "new" www.codeguru.com and has written several books on object-oriented programming and .NET. Check out his upcoming book LINQ Unleashed for C# due July 2008. Paul is an application architect for Electronic Data Systems in Lansing, Michigan. You may contact him for technology questions at pkimmel@softconcepts.com.
If you are interested in joining or sponsoring a .NET Users Group, check out www.glugnet.org. Glugnet opened a users group branch in Flint, Michigan in August 2007. If you are interested in attending, check out the www.glugnet.org web site for updates.
Manipulating Society through Technology
Jeremy Bailenson, Director of the Virtual Human Interaction Lab at Stanford University, talks about virtual reality, avatars, Moore's law, how real world behaviors influence online reality, and societal manipulation through technology! >> Play video >> Read article >> See all videos