O'Reilly logo

Instant .NET 4.5 Extension Methods How-to by Shawn R. McLean

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 1. Instant .NET 4.5 Extension Methods How-to

Welcome to .NET Extension Methods How-to. Here, we will cover how to create and use extension methods ranging from simple string extensions to complex LINQ extensions. It should be noted that this feature of the C# language was implemented in Version 3.0.

Your first extension method (Must know)

Extension methods allow the developer to add their own method to an existing type, without creating a derived type or modifying the existing type. They are mostly suited for cases in which the developer wishes to add additional functionality to existing classes where they may have no access to the source code, such as .NET framework classes found in namespaces like System and Microsoft. In this recipe, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required