C# 3.0 Pocket Reference, 2nd Edition

Book description

This book is for busy programmers who want a succinct and yet readable guide to C# 3.0 and LINQ. C# 3.0 Pocket Reference tells you exactly what you need to know, without long introductions or bloated samples.

Despite its conciseness, this book doesn't skimp on depth or detail, and embraces the conceptual challenges in learning C# 3.0 and LINQ. Tightly focused and highly practical, this pocket reference covers more ground than many of the big books on C#.

C# 3.0 Pocket Reference includes plenty of illustrations and code examples to explain:

  • Features new to C# 3.0, such as lambda expressions, anonymous types, automatic properties, and more
  • All aspects of C# syntax, predefined types, expressions, and operators
  • Creating classes, structs, delegates and events, enums, generics and constraints, exception handling, and iterators
  • The subtleties of boxing, operating overloading, delegate covariance, extension method resolution, interface reimplementation, nullable types, and operating lifting
  • LINQ, starting with the principles of sequences, deferred execution and standard query operators, and finishing with a complete reference to query syntax-including multiple generators, joining, grouping, and query continuations
  • Consuming, writing, and reflecting on custom attributes

You'll also find chapters on unsafe code and pointers, preprocessor directives, XML documentation, and a framework overview. If you're already familiar with Java, C++, or an earlier version of C#, C# 3.0 Pocket Reference is an ideal choice.

No other book or online resource can get you up to speed so quickly.

Publisher resources

View/Submit Errata

Table of contents

  1. C# 3.0 Pocket Reference
  2. 1. C# 3.0 Pocket Reference
    1. What’s New in C# 3.0
    2. A First C# Program
      1. Compilation
    3. Syntax
      1. Identifiers and Keywords
        1. Avoiding conflicts
        2. Contextual keywords
      2. Literals, Punctuators, and Operators
      3. Comments
    4. Type Basics
      1. Predefined Type Examples
      2. Custom Type Examples
        1. Members of a type
        2. Symmetry of predefined types and custom types
        3. Constructors and instantiation
        4. Instance versus static members
        5. The public keyword
      3. Conversions
      4. Value Types Versus Reference Types
        1. Value types
        2. Reference types
        3. Null
        4. Storage overhead
      5. Predefined Type Taxonomy
    5. Numeric Types
      1. Numeric Literals
        1. Numeric literal type inference
        2. Numeric suffixes
      2. Numeric Conversions
        1. Integral to integral conversions
        2. Floating-point to floating-point conversions
        3. Floating-point to integral conversions
        4. Decimal conversions
      3. Arithmetic Operators
      4. Increment and Decrement Operators
      5. Specialized Integral Operations
        1. Integral division
        2. Integral overflow
        3. Integral arithmetic overflow check operators
        4. Overflow checking for constant expressions
        5. Bitwise operators
      6. 8-and 16-Bit Integrals
      7. Special Float and Double Values
      8. double Versus decimal
      9. Real Number Rounding Errors
    6. Boolean Type and Operators
      1. Equality and Comparison Operators
      2. Conditional Operators
    7. Strings and Characters
      1. Char Conversions
      2. String Type
        1. String concatenation
        2. String comparisons
        3. Searching within strings
        4. Manipulating strings
    8. Arrays
      1. Default Element Initialization
        1. Value types versus reference types
      2. Multidimensional Arrays
        1. Rectangular arrays
        2. Jagged arrays
      3. Simplified Array Initialization Expressions
      4. Bounds Checking
    9. Variables and Parameters
      1. The Stack and the Heap
        1. Stack
        2. Heap
      2. Definite Assignment
      3. Default Values
      4. Parameters
        1. Passing arguments by value
        2. The ref modifier
        3. The out modifier
        4. Implications of passing by reference
        5. The params modifier
      5. var: Implicitly Typed Local Variables (C# 3.0)
    10. Expressions and Operators
      1. Primary Expressions
      2. Void Expressions
      3. Assignment Expressions
      4. Operator Precedence and Associativity
        1. Precedence
        2. Left-associative operators
        3. Right-associative operators
      5. Operator Table
    11. Statements
      1. Declaration Statements
        1. Local variables
      2. Expression Statements
      3. Selection Statements
        1. The if statement
        2. The else clause
        3. Changing the flow of execution with braces
        4. The switch statement
      4. Iteration Statements
        1. while and do-while loops
        2. for loops
        3. foreach loops
      5. Jump Statements
        1. The break statement
        2. The continue statement
        3. The goto statement
        4. The return statement
        5. The throw statement
      6. Miscellaneous Statements
    12. Namespaces
      1. The using Directive
      2. Rules Within a Namespace
        1. Name scoping
        2. Name hiding
        3. The global:: qualifier
        4. Repeated namespaces
      3. Aliasing Types and Namespaces
    13. Classes
      1. Fields
        1. Field initialization
        2. Declaring multiple fields together
      2. Methods
        1. Overloading methods
        2. Pass-by-value versus pass-by-reference
      3. Instance Constructors
        1. Overloading constructors
        2. Implicit parameterless constructors
        3. Constructor and field initialization order
        4. Nonpublic constructors
      4. Object Initializers (C# 3.0)
      5. The this Reference
      6. Properties
        1. Read-only and calculated properties
        2. Automatic properties (C# 3.0)
        3. get and set accessibility
      7. Indexers
        1. Implementing an indexer
      8. Constants
      9. Static Constructors
        1. Nondeterminism of static constructors
      10. Static Classes
      11. Finalizers
      12. Partial Types and Methods
        1. Partial methods (C# 3.0)
    14. Inheritance
      1. Polymorphism
      2. Casting
        1. Upcasting
        2. Downcasting
        3. The as operator
        4. The is operator
      3. Virtual Function Members
      4. Abstract Classes and Abstract Members
      5. Hiding Inherited Members
      6. Sealing Functions and Classes
      7. The base Keyword
      8. Constructors and Inheritance
        1. Implicit calling of the parameterless base class constructor
        2. Constructor and field initialization order
      9. Overloading and Resolution
    15. The object Type
      1. Boxing and Unboxing
        1. Copying semantics of boxing and unboxing
      2. Static and Dynamic Type Checking
      3. Object Member Listing
      4. GetType()and typeof
      5. Equals, ReferenceEquals, and GetHashCode
      6. The ToString Method
    16. Structs
      1. Struct Construction Semantics
    17. Access Modifiers
      1. Examples
      2. Accessibility Capping
      3. Restrictions on Access Modifiers
    18. Interfaces
      1. Extending an Interface
      2. Explicit Interface Implementation
      3. Implementing Interface Members Virtually
      4. Reimplementing an Interface in a Subclass
    19. Enums
      1. Enum Conversions
      2. Flags Enumerations
      3. Enum Operators
    20. Nested Types
    21. Generics
      1. Generic Types
      2. Why Generics Exist
      3. Generic Methods
      4. Declaring Generic Parameters
      5. typeof and Generics
      6. The default Generic Value
      7. Generic Constraints
      8. Generics and Covariance
      9. Subclassing Generic Types
      10. Self-Referencing Generic Declarations
      11. Static Data
      12. Generic Collection Initialization
    22. Delegates
      1. Writing Plug-in Methods with Delegates
      2. Multicast Delegates
      3. Instance Versus Static Method Targets
      4. Generic Delegate Types
      5. Delegate Compatibility
        1. Type compatibility
        2. Parameter compatibility
        3. Return type compatibility
    23. Events
      1. Standard Event Pattern
      2. Event Accessors
      3. Event Modifiers
    24. Lambda Expressions (C# 3.0)
      1. Explicitly Specifying Lambda Parameter Types
      2. Generic Lambda Expressions and the Func Delegates
      3. Outer Variables
    25. Anonymous Methods
    26. try Statements and Exceptions
      1. The catch Clause
      2. The finally Block
        1. The using statement
      3. Throwing Exceptions
        1. Rethrowing an exception
      4. Key Properties of System.Exception
      5. Common Exception Types
    27. Enumeration and Iterators
      1. Enumeration
      2. Iterators
      3. Iterator Semantics
        1. Multiple yield statements
        2. yield break
      4. Composing Sequences
    28. Nullable Types
      1. Null Basics
        1. Nullable<T> struct
        2. Implicit and explicit nullable conversions
        3. Boxing and unboxing nullable values
      2. Lifted Operators
        1. Equality operators (== !=)
        2. Relational operators (< <= >= >)
        3. All other operators (+ -* / % & | ^ << >> + ++ --! ~)
        4. Mixing nullable and nonnullable operators
      3. bool?
      4. Null Coalescing Operator
    29. Operator Overloading
      1. Operator Functions
      2. Overloading Equality and Comparison Operators
      3. Custom Implicit and Explicit Conversions
    30. Extension Methods (C# 3.0)
      1. Extension Method Chaining
      2. Ambiguity and Resolution
        1. Namespaces
        2. Extension methods versus instance methods
        3. Extension methods versus extension methods
    31. Anonymous Types (C# 3.0)
    32. LINQ (C# 3.0)
      1. LINQ Fundamentals
        1. A simple query
        2. Projecting
        3. Take and Skip
        4. Element operators
        5. Aggregation operators
        6. Quantifiers
        7. Set operators
      2. Deferred Execution
      3. Standard Query Operators
      4. Chaining Query Operators
      5. Query Syntax
        1. Query syntax versus lambda syntax
      6. The let Keyword
      7. Query Continuations
      8. Multiple Generators
      9. Joining
        1. GroupJoin
      10. Ordering
      11. Grouping
      12. OfType and Cast
    33. Attributes
      1. Attribute Classes
      2. Named and Positional Parameters
      3. Attribute Targets
      4. Specifying Multiple Attributes
      5. Writing Custom Attributes
      6. Retrieving Attributes at Runtime
    34. Unsafe Code and Pointers
      1. Pointer Basics
      2. Unsafe Code
      3. The fixed Statement
      4. The Pointer-to-Member Operator
      5. Arrays
        1. The stackalloc keyword
        2. Fixed-size buffers
      6. void*
      7. Pointers to Unmanaged Code
    35. Preprocessor Directives
      1. Conditional Attributes
      2. Pragma Warning
    36. XML Documentation
      1. Standard XML Documentation Tags
    37. Framework Overview
      1. The Core Framework
        1. System types
        2. Text processing
        3. Collections
        4. Queries
        5. XML
        6. Streams and I/O
        7. Networking
        8. Serialization
        9. Assemblies, reflection, and attributes
        10. Security
        11. Threading
        12. Application domains
        13. Native interoperability
        14. Diagnostics
      2. User Interface Technologies
        1. ASP.NET
        2. Windows Presentation Foundation
        3. Windows Forms
      3. Backend Technologies
        1. ADO.NET
        2. Windows Workflow
        3. COM+ and MSMQ
      4. Distributed System Technologies
        1. Windows Communication Foundation
        2. Remoting and (ASMX) Web Services
        3. CardSpace
  3. Index
  4. About the Authors
  5. Copyright

Product information

  • Title: C# 3.0 Pocket Reference, 2nd Edition
  • Author(s): Joseph Albahari, Ben Albahari
  • Release date: February 2008
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781449379438