Synopses & Reviews
After a dozen years of incremental changes, C# has become one of the most versatile programming languages available. With this comprehensive guide, youll learn just how powerful the combination of C# 5.0 and .NET 4.5 can be. Author Ian Griffiths guides you through C# 5.0 fundamentals and teaches you techniques for building web and desktop applications, including Windows 8-style apps.
Completely rewritten for experienced programmers, this book provides many code examples to help you work with the nuts and bolts of C# code, such as generics, dynamic typing, and the new asynchronous programming features. Youll also get up to speed on XAML, ASP.NET, LINQ, and other .NET tools.
- Discover how C# supports fundamental coding features such as classes, other custom types, collections, and error handling
- Understand the differences between dynamic and static typing in C#
- Query and process diverse data sources such as in-memory object models, databases, and XML documents with LINQ
- Use .NETs multithreading features to exploit your computers parallel processing capabilities
- Learn how the new asynchronous language features can help improve application responsiveness and scalability
- Use XAML to create Windows 8-style, phone, and classic desktop applications
With its support for dynamic programming, C# 5.0 continues to evolve as a versatile language on its own. But when C# is used with .NET Framework 4.5, the combination is incredibly powerful. This bestselling tutorial shows you how to build web, desktop and rich Internet applications using C# 5.0 with .NET's database capabilities, UI framework (WPF), extensive communication services (WCF), and more.
In this book, .NET expert Ian Griffiths cover the latest enhancements to C#, as well as the fundamentals of both the language and the framework. You'll learn concurrent and asynchronous programming with C# 5.0 and how to use .NET tools such as the Entity Framework for easier data access.
- Learn C# fundamentals such as variables, flow control, loops, and methods
- Build complex programs with object-oriented and functional programming techniques
- Process large collections of data with the native query features in LINQ
- Learn all about asynchrony new to C# 5.0
About the Author
Ian Griffiths is an independent WPF consultant, developer, speaker and Pluralsight instructor and a widely recognized expert on the subject. He lives in London but can often be found on various developer mailing lists and newsgroups, where a popular sport is to see who can get him to write the longest email in reply to the shortest possible question. Ian maintains a popular blog at http://www.interact-sw.co.uk/iangblog/ and is co-author of "Windows Forms in a Nutshell" and of "Mastering Visual Studio .NET".
Table of Contents
Preface; Who This Book Is For; Conventions Used in This Book; Using Code Examples; Safari® Books Online; How to Contact Us; Acknowledgments; Chapter 1: Introducing C#; 1.1 Why C#?; 1.2 Why Not C#?; 1.3 C#'s Defining Features; 1.4 Visual Studio; 1.5 Anatomy of a Simple Program; 1.6 Summary; Chapter 2: Basic Coding in C#; 2.1 Local Variables; 2.2 Statements and Expressions; 2.3 Comments and Whitespace; 2.4 Preprocessing Directives; 2.5 Intrinsic Data Types; 2.6 Operators; 2.7 Flow Control; 2.8 Summary; Chapter 3: Types; 3.1 Classes; 3.2 Structs; 3.3 Members; 3.4 Interfaces; 3.5 Enums; 3.6 Other Types; 3.7 Partial Types and Methods; 3.8 Summary; Chapter 4: Generics; 4.1 Generic Types; 4.2 Constraints; 4.3 Zero-Like Values; 4.4 Generic Methods; 4.5 Inside Generics; 4.6 Summary; Chapter 5: Collections; 5.1 Arrays; 5.2 List; 5.3 List and Sequence Interfaces; 5.4 Implementing Lists and Sequences; 5.5 Dictionaries; 5.6 Sets; 5.7 Queues and Stacks; 5.8 Linked Lists; 5.9 Concurrent Collections; 5.10 Tuples; 5.11 Summary; Chapter 6: Inheritance; 6.1 Inheritance and Conversions; 6.2 Interface Inheritance; 6.3 Generics; 6.4 System.Object; 6.5 Accessibility and Inheritance; 6.6 Virtual Methods; 6.7 Sealed Methods and Classes; 6.8 Accessing Base Members; 6.9 Inheritance and Construction; 6.10 Special Base Types; 6.11 Summary; Chapter 7: Object Lifetime; 7.1 Garbage Collection; 7.2 Destructors and Finalization; 7.3 IDisposable; 7.4 Boxing; 7.5 Summary; Chapter 8: Exceptions; 8.1 Exception Sources; 8.2 Handling Exceptions; 8.3 Throwing Exceptions; 8.4 Exception Types; 8.5 Unhandled Exceptions; 8.6 Asynchronous Exceptions; 8.7 Summary; Chapter 9: Delegates, Lambdas, and Events; 9.1 Delegate Types; 9.2 Inline Methods; 9.3 Events; 9.4 Delegates Versus Interfaces; 9.5 Summary; Chapter 10: LINQ; 10.1 Query Expressions; 10.2 Deferred Evaluation; 10.3 LINQ, Generics, and IQueryable; 10.4 Standard LINQ Operators; 10.5 Sequence Generation; 10.6 Other LINQ Implementations; 10.7 Summary; Chapter 11: Reactive Extensions; 11.1 Rx and .NET Versions; 11.2 Fundamental Interfaces; 11.3 Publishing and Subscribing with Delegates; 11.4 Sequence Builders; 11.5 LINQ Queries; 11.6 Rx Query Operators; 11.7 Schedulers; 11.8 Subjects; 11.9 Adaptation; 11.10 Timed Operations; 11.11 Summary; Chapter 12: Assemblies; 12.1 Visual Studio and Assemblies; 12.2 Anatomy of an Assembly; 12.3 Type Identity; 12.4 Loading Assemblies; 12.5 Assembly Names; 12.6 Portable Class Libraries; 12.7 Packaged Deployment; 12.8 Protection; 12.9 Summary; Chapter 13: Reflection; 13.1 Reflection Types; 13.2 Reflection Contexts; 13.3 Summary; Chapter 14: Dynamic Typing; 14.1 The dynamic Type; 14.2 dynamic and Interoperability; 14.3 Inside Dynamic; 14.4 Limitations of dynamic; 14.5 Summary; Chapter 15: Attributes; 15.1 Applying Attributes; 15.2 Defining and Consuming Custom Attributes; 15.3 Summary; Chapter 16: Files and Streams; 16.1 The Stream Class; 16.2 Windows 8 and IRandomAccessStream; 16.3 Text-Oriented Types; 16.4 Files and Directories; 16.5 Serialization; 16.6 Summary; Chapter 17: Multithreading; 17.1 Threads; 17.2 Synchronization; 17.3 Tasks; 17.4 Other Asynchronous Patterns; 17.5 Cancellation; 17.6 Parallelism; 17.7 Summary; Chapter 18: Asynchronous Language Features; 18.1 Asynchronous Keywords: async and await; 18.2 The await Pattern; 18.3 Error Handling; 18.4 Summary; Chapter 19: XAML; 19.1 XAML-Based Frameworks; 19.2 XAML Basics; 19.3 Layout; 19.4 Controls; 19.5 Text; 19.6 Data Binding; 19.7 Graphics; 19.8 Styles; 19.9 Summary; Chapter 20: ASP.NET; 20.1 Razor; 20.2 Web Forms; 20.3 MVC; 20.4 Routing; 20.5 Summary; Chapter 21: Interoperability; 21.1 Calling Native Code; 21.2 Platform Invoke; 21.3 COM; 21.4 Windows Runtime; 21.5 Unsafe Code; 21.6 C++/CLI and the Component Extensions; 21.7 Summary; Colophon;