Trey Nash
Many books introduce C#, but if you don't have the time to read 1200 pages, Accelerated C# 2008 gives you everything you need to know about C# 2008 in a concentrated 500 pages of must-know information and best practices.
Introduction
C# 2008 offers powerful new features, and Accelerated C# 2008 is the fastest path to mastery, for both experienced C# programmers moving to C# 2008 and programmers moving to C# from another object-oriented language.
You’ll quickly master C# syntax while learning how the CLR simplifies many programming tasks. You’ll also learn best practices that ensure your code will be efficient, reusable, and robust. Why spend months or years discovering the best ways to design and code C# when this book will show you how to do things the right way, right from the start?
What you’ll learn
Who is this book for?
If you’re an experienced C# programmer, you need to understand how C# has changed with C# 2008. If youre an experienced object–oriented programmer moving to C#, you want to ramp up quickly in the language while learning the latest features and techniques. In either case, this book is for you. The first three chapters succinctly present C# fundamentals, for those new to or reviewing C#. The rest of the book covers all the major C# features, in great detail, explaining how they work and how best to use them. Whatever your background or need, youll treasure this book for as long as you code in C# 2008.
Author Information
Trey Nash is a principal software engineer working on PC Bluetooth solutions at Cambridge Silicon Radio. Before focusing on .NET, he specialized in COM/DCOM programming in C, C++, and ATL. Trey earned his bachelor of science and master of engineering degrees in electrical engineering from Texas A&M University.
What is in this book
Contents
ForewordAbout the Author About the Technical Reviewer AcknowledgmentsIntroductionCHAPTER 1: C# Preview
Differences Between C# and C++ C# 1 C++ CLR Garbage CollectionExample of a C# ProgramOverview of Features Added in C# 2.0Overview of What’s New in C# 3.0Summary
CHAPTER 2: C# and the CLR
The JIT Compiler in the CLRAssemblies and the Assembly Loader Minimizing the Working Set of the Application Naming Assemblies Loading AssembliesMetadataCross-Language CompatibilitySummary
CHAPTER 3: C# Syntax Overview
C# Is a Strongly Typed LanguageExpressionsStatements and ExpressionsTypes and Variables Value Types Reference Types Default Variable Initialization Implicitly Typed Local Variables Type Conversion as and is Operators GenericsNamespaces Defining Namespaces Using NamespacesControl Flow if-else, while, do-while, and for switch foreach break, continue, goto, return, and throwSummary
CHAPTER 4: Classes, Structs, and Objects
Class Definitions Fields Constructors Methods Properties Encapsulation Accessibility Interfaces Inheritance sealed Classes abstract Classes Nested Classes Indexers partial Classes partial Methods Static Classes Reserved Member NamesValue Type Definitions Constructors The Meaning of this Finalizers InterfacesAnonymous TypesObject InitializersBoxing and Unboxing When Boxing Occurs Efficiency and ConfusionSystem.Object Equality and What It Means The IComparable InterfaceCreating Objects The new Keyword Field Initialization Static (Class) Constructors Instance Constructor and Creation OrderingDestroying Objects Finalizers Deterministic Destruction Exception HandlingDisposable Objects The IDisposable Interface The using KeywordMethod Parameter Types Value Arguments ref Arguments out Parameters param ArraysMethod OverloadingInheritance and Virtual Methods Virtual and Abstract Methods override and new Methods sealed Methods A Final Few Words on C# Virtual MethodsInheritance, Containment, and Delegation Choosing Between Interface and Class Inheritance Delegation and Composition vs. InheritanceSummary
CHAPTER 5: Interfaces and Contracts
Interfaces Define TypesDefining Interfaces What Can Be in an Interface? Interface Inheritance and Member Hiding Implementing Interfaces Implicit Interface Implementation Explicit Interface Implementation Overriding Interface Implementations in Derived Classes Beware of Side Effects of Value Types Implementing Interfaces Interface Member Matching Rules Explicit Interface Implementation with Value Types Versioning Considerations Contracts Contracts Implemented with Classes Interface ContractsChoosing Between Interfaces and ClassesSummary
CHAPTER 6: Overloading Operators
Just Because You Can Doesn’t Mean You Should Types and Formats of Overloaded Operators Operators Shouldn’t Mutate Their Operands Does Parameter Order Matter? Overloading the Addition Operator Operators That Can Be Overloaded Comparison Operators Conversion Operators Boolean Operators Summary
CHAPTER 7: Exception Handling and Exception Safety
How the CLR Treats ExceptionsMechanics of Handling Exceptions in C# Throwing Exceptions Changes with Unhandled Exceptions Starting with .NET 2.0 Syntax Overview of the try Statement Rethrowing Exceptions and Translating Exceptions Exceptions Thrown in finally Blocks Exceptions Thrown in Finalizers Exceptions Thrown in Static ConstructorsWho Should Handle Exceptions?Avoid Using Exceptions to Control FlowAchieving Exception Neutrality Basic Structure of Exception-Neutral Code Constrained Execution Regions Critical Finalizers and SafeHandleCreating Custom Exception ClassesWorking with Allocated Resources and ExceptionsProviding Rollback BehaviorSummary
CHAPTER 8: Working with Strings
String OverviewString LiteralsFormat Specifiers and Globalization Object.ToString, IFormattable, and CultureInfo Creating and Registering Custom CultureInfo Types Format Strings Console.WriteLine and String.Format Examples of String Formatting in Custom Types ICustomFormatter Comparing StringsWorking with Strings from Outside Sources StringBuilder Searching Strings with Regular Expressions Searching with Regular Expressions Searching and Grouping Replacing Text with Regex Regex Creation OptionsSummary
CHAPTER 9: Arrays, Collection Types, and Iterators
Introduction to Arrays Implicitly Typed Arrays Type Convertibility and Covariance Sortability and Searchability Synchronization Vectors vs. ArraysMultidimensional Rectangular ArraysMultidimensional Jagged ArraysCollection Types Comparing ICollection with ICollection Collection Synchronization Lists Dictionaries Sets System.Collections.ObjectModel EfficiencyIEnumerable <T>, IEnumerator <T>, IEnumerable, and IEnumerator Types That Produce CollectionsIterators Forward, Reverse, and Bidirectional Iterators Collection Initializers Summary
CHAPTER 10: Delegates, Anonymous Functions, and Events
Overview of DelegatesDelegate Creation and Use Single Delegate Delegate Chaining Iterating Through Delegate Chains Unbound (Open Instance) Delegates EventsAnonymous Methods Beware the Captured Variable Surprise Anonymous Methods as Delegate Parameter BindersThe Strategy PatternSummary
CHAPTER 11: Generics
Difference Between Generics and C++ TemplatesEfficiency and Type Safety of GenericsGeneric Type Definitions and Constructed Types Generic Classes and Structs Generic Interfaces Generic Methods Generic Delegates Generic Type Conversion Default Value Expression Nullable Types Constructed Types Control Accessibility Generics and InheritanceConstraints Constraints on Nonclass TypesGeneric System CollectionsGeneric System InterfacesSelect Problems and Solutions Conversion and Operators Within Generic Types Creating Constructed Types DynamicallySummary
CHAPTER 12: Threading in C#
Threading in C# and .NET Starting Threads The IOU Pattern and Asynchronous Method Calls States of a Thread Terminating Threads Halting Threads and Waking Sleeping Threads Waiting for a Thread to Exit Foreground and Background Threads Thread-Local Storage How Unmanaged Threads and COM Apartments Fit InSynchronizing Work Between Threads Lightweight Synchronization with the Interlocked Class Monitor Class Locking Objects Semaphore Events Win32 Synchronization Objects and WaitHandleUsing ThreadPool Asynchronous Method Calls TimersSummary
CHAPTER 13: In Search of C# Canonical Forms
Reference Type Canonical Forms Default to sealed Classes Use the Non-Virtual Interface (NVI) Pattern Is the Object Cloneable? Is the Object Disposable? Does the Object Need a Finalizer? What Does Equality Mean for This Object? If You Override Equals, Override GetHashCode Too Does the Object Support Ordering? Is the Object Formattable? Is the Object Convertible? Prefer Type Safety at All Times Using Immutable Reference TypesValue Type Canonical Forms Override Equals for Better Performance Do Values of This Type Support Any Interfaces? Implement Type-Safe Forms of Interface Members and Derived MethodsSummary Checklist for Reference Types Checklist for Value Types
CHAPTER 14: Extension Methods
Introduction to Extension Methods How Does the Compiler Find Extension Methods? Under the Covers Code Readability vs. Code UnderstandabilityRecommendations for Use Consider Extension Methods Over Inheritance Isolate Extension Methods in Separate Namespace Changing a Type’s Contract Can Break Extension MethodsTransforms Operation Chaining Custom Iterators Borrowing from Functional Programming The Visitor PatternSummary
CHAPTER 15: Lambda Expressions
Introduction to Lambda Expressions Lambda Expressions Lambda StatementsExpression Trees Operating on Expressions Functions As Data Useful Applications of Lambda Expressions Iterators and Generators Revisited Closures (Variable Capture) and Memoization Currying Anonymous RecursionSummary
CHAPTER 16 LINQ: Language Integrated Query
A Bridge to Data Query Expressions Extension Methods and Lambda Expressions Revisited Standard Query Operators C# Query Keywords The from Clause and Range Variables The join Clause The where Clause and Filters The orderby Clause The select Clause and Projection The let Clause The group Clause The into Clause and ContinuationsThe Virtues of Being Lazy C# Iterators Foster Laziness Subverting Laziness Executing Queries Immediately Expression Trees RevisitedTechniques from Functional Programming Custom Standard Query Operators and Lazy Evaluation Replacing foreach StatementsSummary
APPENDIX References
Blogs
INDEX
Note:
Mindcracker Network accepts no liability for providing the customer with the hard copy of the book purchased. Mindcracker is not responsible for any dispute relating to the above. All eBooks listed in this section are in "PDF" Format. Contact [email protected] for further assistant.
Unlock unlimited ebook downloads. Share it on your social profile.