viicontentsforewordxviiprefacexixacknowledgmentsxxabout this bookxxiiabout the authorxxviabout the cover illustrationxxviiPART 1C# IN CONTEXT ............................................... 11 Survival of the sharpest31.1An evolving language3A helpful type system at large and small scales4■ Ever more concise code6■ Simple data access with LINQ9Asynchrony10■ Balancing efficiency and complexity11Evolution at speed: Using minor versions121.2An evolving platform131.3An evolving community141.4An evolving book15Mixed-level coverage16■ Examples using Noda Time16Terminology choices17 CONTENTSviiiPART 2C# 2–5 .......................................................... 19 2 C# 2212.1Generics22Introduction by example: Collections before generics22Generics save the day25■ What can be generic?29Type inference for type arguments to methods30■ Type constraints32■ The default and typeof operators34Generic type initialization and state372.2Nullable value types38Aim: Expressing an absence of information39■ CLR and framework support: The Nullable struct40■ Language support432.3Simplified delegate creation49Method group conversions50■ Anonymous methods50Delegate compatibility522.4Iterators53Introduction to iterators54■ Lazy execution55■ Evaluation of yield statements56■ The importance of being lazy57Evaluation of finally blocks58■ The importance of finally handling61■ Implementation sketch622.5Minor features66Partial types67■ Static classes69■ Separate getter/setter access for properties69■ Namespace aliases70Pragma directives72■ Fixed-size buffers73InternalsVisibleTo733 C# 3: LINQ and everything that comes with it753.1Automatically implemented properties763.2Implicit typing77Typing terminology77■ Implicitly typed local variables (var)78■ Implicitly typed arrays793.3Object and collectio...