You are previewing Instant .NET 4.5 Extension Methods How-to.
O'Reilly logo
Instant .NET 4.5 Extension Methods How-to

Book Description

Utilize and harness the power of extension methods in your .NET applications

  • 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

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 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.

Table of Contents

  1. Instant .NET 4.5 Extension Methods How-to
    1. Instant .NET 4.5 Extension Methods How-to
    2. Credits
    3. About the Author
    4. About the Reviewer
    5. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    6. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    7. 1. Instant .NET 4.5 Extension Methods How-to
      1. Your first extension method (Must know)
        1. Getting ready
        2. How to do it...
        3. How it works...
      2. Extension methods on string data types (Must know)
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more…
      3. Extension methods on classes (Should know)
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more…
      4. Chaining extension methods (Should know)
        1. Getting ready
        2. How to do it...
        3. How it works...
      5. Overloading extension methods (Should know)
        1. Getting ready
        2. How to do it...
        3. How it works...
      6. Overriding extension methods (Should know)
        1. Getting ready
        2. How to do it...
        3. How it works...
      7. Extension methods on interfaces (Should know)
        1. Getting ready
        2. How to do it...
        3. How it works...
      8. Extension methods on enumerables (Should know)
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      9. Extension methods on IQueryable (Become an expert)
        1. Getting ready
        2. How to do it...
        3. How it works...
      10. Extension methods with generics (Become an expert)
        1. Getting ready
        2. How to do it...
        3. How it works...
      11. Extension methods with lambda expressions (Become an expert)
        1. Getting ready
        2. How to do it...
        3. How it works...
      12. Structuring your project and best practices (Should know)
        1. Getting ready
        2. How to do it...
        3. How it works...
      13. Appendix – List of well-known extension libraries