Basic Instincts: Extension methods in Visual Basic

You typically extend a class by deriving from a base class and enhancing the functionality in the derived class. A new feature in Visual Basic 2008, you extend any existing type's functionality, even when a type is not inheritable.

In the November issue of MSDN Magazine, Adrian "Spotty" Bowles explains how extension methods provide a simple mechanism to extend types in the system with new methods. Extension methods create the illusion that they are defined on a real type, but, in reality, no changes are made to the original types.

And these extension methods play a crucial role in the implementation of LINQ.

For more information about Visual Basic development, check out the Basic Instincts archive on the MSDN Magazine web site or subscribe to the Basic Instincts RSS feed.

Plus, you can explore the Visual Basic Developer Center to find tools, articles, starter kits, and more.



Comments (0)

Skip to main content