Instant .NET 4.5 Extension Methods How-to [Instant]

This title is available as an eBook only
Instant .NET 4.5 Extension Methods How-to [Instant]
eBook: $19.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print & eBook also available on:
Learn in an Instant - Short, Fast, Focused
Table of Contents
Sample Chapters
  • Learn something new in an Instant! A short, fast, focused guide delivering immediate results.
  • Explains how to write your own extension methods on types ranging from primitive to complex
  • Shows caveats to watch out for and apply workarounds to them
  • Helps to better architect your applications to maximize code maintainability

Book Details

Language : English
eBook : 52 pages
Release Date : April 2013
ISBN : 1849688567
ISBN 13 : 9781849688567
Author(s) : Shawn R. McLean
Topics and Technologies : All Books, Application Development, Instant, Enterprise, .NET

Table of Contents

Instant .NET 4.5 Extension Methods How-to
  • Instant .NET 4.5 Extension Methods How-to
    • Your first extension method (Must know)
    • Extension methods on string data types (Must know)
    • Extension methods on classes (Should know)
    • Chaining extension methods (Should know)
    • Overloading extension methods (Should know)
    • Overriding extension methods (Should know)
    • Extension methods on interfaces (Should know)
    • Extension methods on enumerables (Should know)
    • Extension methods on IQueryable (Become an expert)
    • Extension methods with generics (Become an expert)
    • Extension methods with lambda expressions (Become an expert)
    • Structuring your project and best practices (Should know)
    • Appendix – List of well-known extension libraries

Shawn R. McLean

Shawn R. McLean is passionate about architecting and developing scalable mobile and web applications based on the Microsoft .NET platform using ASP.NET MVC, ASP.NET WebAPI, and C#, along with using open source frameworks. He is an advocate of software and builds engineering methodologies for a streamlined development process. Besides his love for software engineering, architecture, and design, he also focuses on artificial intelligence and has interest in researching on computer vision and machine learning.

In 2008, he was a gold medalist in the web design category of World Skills Jamaica and a Best of Nation awardee for World Skills International, 2009. In 2009, he was also a finalist for the Microsoft Imagine Cup software design competition in Egypt, where he was the team lead of four, successfully clearing three rounds in a competition of more than 15 teams from around the Central Caribbean. In 2010, he led his team to first place of the Imagine Cup Interoperability award in Poland. He is also the recipient of Jamaica’s Prime Minister’s Youth Awards, Governor General’s iBelieve award, the Gleaner award, and the Chamber of Commerce award for outstanding innovation in the field of technology and science.

He is currently employed by the University Information System Services division of Northern Caribbean University, where he is part of a software engineering team that builds student and learning management systems for universities and high schools. He is also the co-founder of Xormis, a start-up software engineering company that makes in-house mobile and web-based applications for commercial use.

It is a well put together book, notwithstanding the cosmetic shortfalls which I’m sure in any piece of literature - Trevior Williams

Extension methods aren't too difficult, so a beginner could easily know what they need to after reading this book, and the best practices could even get them ahead - James Skemp

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


- 2 submitted: last submission 16 Jul 2013

Errata type: Technical | Page number: 10

In the How it works... section, “...and cleaning a string for SQL injection” should be replaced by “...and cleaning a string from SQL injection”

Errata type: Typo | Page number: 12

In the line “The following code shows shows the use of the extension methods:” shows is repeated twice

Sorry, there are currently no downloads available for this title.

Frequently bought together

Instant .NET 4.5 Extension Methods How-to [Instant] +    Building Minecraft Server Modifications =
50% Off
the second eBook
Price for both: €24.65

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Extending primitive and complex types
  • Tricks and caveats of extending the string data type
  • Method chaining using extension methods
  • Extending interfaces while taking inheritance into consideration
  • Structuring your project to incorporate proper namespace convention when using extension methods
  • Knowing how and when to extend IEnumerable versus IQueryable for performance and optimization of queries
  • Structuring your project to incorporate proper namespace convention when using extension methods

In Detail

.NET extension methods is an essential feature to know and understand for all .NET developers. Usage of extension methods is found in applications ranging from small to large scale enterprise systems built using the .NET framework. Create and use extension methods the correct way to save your development time and maintainability costs.

Instant .NET 4.5 Extension Methods How-to is a practical, hands-on guide that provides you with a number of clear, step-by-step exercises that will help you take advantage of the real power that is behind extension methods and gives you good knowledge of how to use them in your .NET applications.

This book covers how to create, write, and use different types of extension methods. It will take you through a number of clear, practical recipes that will help you take advantage of the power of extension methods in the quickest possible way.

You will also learn exactly how to create extension methods on strings, interfaces, classes such as IQueryable and IEnumerable, and so on. You will write them from scratch and then use them practically in your application. You will also learn the most suitable scenarios for using these extension methods.You will learn everything you need to know about creating your own extension methods and using them and other external extension methods.


Filled with practical, step-by-step instructions and clear explanations for the most important and useful tasks.The book is packed with quick recipes on creating and extending extension methods in your .NET applications.

Who this book is for

This book is for developers in C# and the .NET framework, with a basic understanding of language syntax and OOP concepts. Readers are expected to have some experience in finding their way around Visual Studio.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software