Expert C# 5.0: with the .NET 4.5 Framework

Book description

Expert C# 5.0 is a book about getting the best from C#. It's based on the principle that to write good, high-performance, robust applications you need to understand whats going on deep under the hood. If you are already experienced with writing managed applications and want to learn more about how to get the best from the language at an advanced level, then this is the book for you.

Expert C# 5.0 discusses the familiar C# language in forensic detail. Examining familiar elements closely to reveal how they really work. Key language features that you are already familiar with, such as Enums, Strings and Collections, are teased apart and examined under the twin microscopes of MSIL (Intermediate Language) and the Windbg debugger to see what's really going on behind the scenes as your code is compiled and passed to the CLR.

This unparalleled depth of explanation will help you to become a true master of the C# language and architect better crafted applications that work in the most efficient and reliable way possible. It will also give you the insight you need to rapidly identify and fix the stubborn coding faults that others may be unable to diagnose.

What you'll learn

  • Learn the detailed workings behind common language elements such as Enum, readonly, Anonymous and Func.

  • Understand how to work with Strings and StringBuilder in the most effective way.

  • Master Exception management far beyond the basics.

  • See how components such as LINQ and Async interact with the C# language beneath the surface.

  • Who this book is for

    This book is for experienced C# developers who are comfortable working with the language. You should be happy creating non-trivial code samples and ready to delve into the detail of the language's workings in order to truly master the concepts.

    Table of contents

    1. Titlepage
    2. Contents at a Glance
    3. Contents
    4. About the Author
    5. About the Technical Reviewer
    6. Acknowledgments
    7. Chapter 1: Reintroducing C#:-A Detailed Look at the Language We All Know
      1. Square Number Using the C#
      2. Compilation of a C# Program
      3. Understanding the C# Language
      4. Summary
    8. Chapter 2: C# Objects in Memory
      1. Memory in .NET Applications
      2. The Stack
      3. The Heap
      4. Value and Reference Types
      5. Instantiating an Object
      6. Boxing and Unboxing
      7. Garbage Collection
      8. Summary
    9. Chapter 3: Parameters
      1. Parameter
      2. Method State Description Table
      3. Value Type
      4. Reference Type
      5. Default Parameter Value
      6. Summary
    10. Chapter 4: Methods
      1. Instance and Static Method with this Keyword
      2. Anonymous Method
      3. Extension Method
      4. Summary
    11. Chapter 5: Automatic Property Declaration
      1. Automatic Property
      2. var Implicitly Typed Local Variable
      3. Anonymous Type
      4. Summary
    12. Chapter 6: Enum
      1. Enum and .NET
      2. How to Get Names and Values from the Enum
      3. Determining Whether an Item Is Defined
      4. Parsing
      5. Summary
    13. Chapter 7: Delegate
      1. Understanding Delegates
      2. Func and Action
      3. Summary
    14. Chapter 8: Event
      1. Understanding the Event
      2. Designing a Type with the Event
      3. Behind the Scenes
      4. Summary
    15. Chapter 9: Foreach and Iterator
      1. State Machine
      2. Foreach Statement
      3. Iterators
      4. Summary
    16. Chapter 10: The String Data Type
      1. String in .NET
      2. Instantiation of a String Object
      3. String and Chaining
      4. Strings Are Immutable
      5. String Concatenation
      6. StringBuilder
      7. Summary
    17. Chapter 11: Collections Explained
      1. Collections in .NET
      2. Array Class
      3. List
      4. ArrayList
      5. Stack
      6. Queue
      7. Hashtable
      8. Dictionary
      9. Summary
    18. Chapter 12: Linq in C#
      1. First Look into Linq in .NET
      2. Extension Method
      3. Lambda Expressions and Expression Trees in Linq
      4. Deferred Execution in Linq
      5. Query Methods in Linq
      6. Summary
    19. Chapter 13: Exception Management
      1. What Is an Exception?
      2. Exception and .NET Framework
      3. Exception Handling in .NET
      4. Protected Block
      5. Throw and Rethrow
      6. Stack Overwrite
      7. How the CLR Matches Exception in Runtime
      8. Using Statement
      9. Summary
    20. Chapter 14: Asynchrony
      1. Synchronous and Asynchronous Programming
      2. Asynchronous Programming Using Task
      3. ExecutionContext to Capture the Context
      4. Asynchronous Programming Using Async and Await
      5. Async Behind the Scenes
      6. Test Cases
      7. Task-Based Asynchronous Pattern
      8. Summary
    21. Chapter 15: Diagnostic Tools in .NET
      1. Windbg and Son of Strike Debugging Extension DLL
      2. Intermediate Language Disassembler
      3. The .NET Reflector: Source Code Explorer
      4. CLR Profiler: A Memory Profiler
      5. Summary
    22. Index

    Product information

    • Title: Expert C# 5.0: with the .NET 4.5 Framework
    • Author(s):
    • Release date: December 2012
    • Publisher(s): Apress
    • ISBN: 9781430248606