C# Precisely, 2e

by Sestoft, Hansen

ISBN: 9780262300599 | Copyright 2011

Click here to preview

Instructor Requests

Digital Exam/Desk Copy Print Desk Copy Ancillaries
Tabs
C# is an object-oriented programming language that is similar to Java in many respects but more comprehensive and different in most details. This book offers a quick and accessible reference for anyone who wants to know C# in more detail than that provided by a standard textbook. It will be particularly useful for C# learners who are familiar with Java. This second edition has been updated and expanded, reflecting the evolution and extension of the C# programming language. It covers C# versions 3.0 and 4.0 and takes a look ahead at some of the innovations of version 5.0. In particular, it describes asynchronous programming as found in 5.0.Despite the new material, C# Precisely remains compact and easy to navigate. It describes C# in detail but informally and concisely, presenting lambda expressions, extension methods, anonymous object expressions, object initializers, collection initializers, local variable type inference, type dynamic, type parameter covariance and contravariance, and Linq (language integrated query), among other topics, all in aabout 250 pages. The book offers more than 250 examples to illustrate both common use and subtle points. Two-page spreads show general rules on the left and relevant examples on the right, maximizing the amount of information accessible at a glance.The complete, ready-to-run example programs are available at the book's Web site, http://www.itu.dk/people/sestoft/csharpprecisely/
Expand/Collapse All
Contents (pg. v)
Preface (pg. xi)
Notational Conventions (pg. xii)
1. Compiling, Loading, and Executing C# Programs (pg. 2)
1.1 Source Files and Compilation (pg. 2)
1.2 Execution (pg. 2)
2. Names and Reserved Names (pg. 4)
3. C# Naming Conventions (pg. 4)
4. Comments and Program Layout (pg. 4)
4. Comments and Program Layout (pg. 4)
5. Data and Types (pg. 6)
5.1 Value Types and Simple Types (pg. 6)
5.2 Reference Types (pg. 8)
5.3 Conversion (pg. 10)
6. Variables, Parameters, Fields, and Scope (pg. 14)
6.1 Scope of Variables, Parameters, and Members (Including Fields) (pg. 14)
6.2 Default Values and Definite Assignment (pg. 14)
6.3 Local var Declarations: Compile-Time Type Inference (C# 3.0) (pg. 16)
6.4 The Type dynamic: Run-Time Resolution of Calls and More (C# 4.0) (pg. 16)
7. Strings (pg. 18)
7.1 String Methods (pg. 20)
7.2 String Formatting (pg. 22)
8. String Builders (pg. 26)
9. Arrays (pg. 28)
9.1 One-Dimensional Arrays (pg. 28)
9.2 Multidimensional Arrays (pg. 30)
9.3 Class Array (pg. 32)
10. Classes (pg. 34)
10.1 Class Declarations and Class Bodies (pg. 34)
10.2 Class Modifiers abstract, sealed, static (pg. 36)
10.3 Member Access Modifiers private, protected, internal, public (pg. 36)
10.4 Subclass, Base Class, Inheritance, and Hiding (pg. 38)
10.5 Field Declarations in Classes (pg. 40)
10.6 Constant Declarations in Classes (pg. 40)
10.7 Method Declarations (pg. 42)
10.8 Method Modifiers static new virtual override sealed abstract (pg. 44)
10.9 Extension Methods (C# 3.0) (pg. 46)
10.10 Optional or Default-Value Method Parameters (C# 4.0) (pg. 46)
10.11 Constructor Declarations (pg. 48)
10.12 Static Field Initialization and the Static Constructor (pg. 48)
10.13 Member Classes or Nested Classes (pg. 50)
10.14 Class Access Modifiers (pg. 50)
10.15 Property Declarations (pg. 52)
10.16 Indexer Declarations (pg. 52)
10.17 Operator Overloading (pg. 54)
10.18 User-Defined Conversion Operators (pg. 56)
11. The Machine Model: Stack, Heap, and Garbage Collection (pg. 58)
11.1 Class and Object versus Struct Type and Struct Value (pg. 58)
12. Expressions (pg. 60)
12.1 Table of Expression Forms and Predefined Operators (pg. 60)
12.2 Arithmetic Operators (pg. 62)
12.3 The checked and unchecked Operators (pg. 62)
12.4 Logical Operators (pg. 62)
12.5 Bitwise Operators and Shift Operators (pg. 64)
12.6 Comparison Operators (pg. 64)
12.7 Assignment Expression (pg. 66)
12.8 Conditional Expression (pg. 66)
12.9 Object Creation Expression (pg. 68)
12.10 Object Initializer (C# 3.0) (pg. 68)
12.11 Collection Initializers (C# 3.0) (pg. 68)
12.12 Struct Value Creation Expression (pg. 70)
12.13 Instance Test Expression (pg. 70)
12.14 Instance Test and Cast Expression (pg. 70)
12.15 Field Access Expression (pg. 72)
12.16 The Current Object Reference this (pg. 72)
12.17 Method Call Expression (pg. 74)
12.18 Property Access Expression (pg. 84)
12.19 Indexer Access Expression (pg. 86)
12.20 Type Cast Expression (pg. 88)
12.21 The typeof Operator (pg. 88)
12.22 Anonymous Method Expression (pg. 90)
12.23 Lambda Expressions (C# 3.0) (pg. 92)
12.24 Anonymous Object Expressions (C# 3.0) (pg. 92)
12.25 Implicitly Typed Array Creation Expressions (C# 3.0) (pg. 92)
13. Statements (pg. 94)
13.1 Expression Statement (pg. 94)
13.2 Block Statement (pg. 94)
13.3 The Empty Statement (pg. 94)
13.4 Declaration Statement (pg. 94)
13.5 Choice Statements (pg. 96)
13.6 Loop Statements (pg. 98)
13.7 Returns, Labeled Statements, Exits, and Jumps (pg. 102)
13.8 Throwing and Catching Exceptions (pg. 104)
13.9 The checked and unchecked Statements (pg. 108)
13.10 The using Statement (pg. 108)
13.11 The lock Statement (pg. 108)
13.12 The yield Statement and Iterators (pg. 110)
14. Struct Types (pg. 112)
14.1 Boxing of Struct Values (pg. 114)
14.2 The this Reference in a Struct (pg. 114)
14.3 Struct Expressions: Value or Variable (pg. 114)
15. Interfaces (pg. 116)
15.1 Interface Declarations (pg. 116)
15.2 Classes and Struct Types Implementing Interfaces (pg. 118)
15.3 Explicit Interface Member Implementations (pg. 118)
16. Enum Types (pg. 120)
17. Delegate Types (pg. 122)
18. Type dynamic (C# 4.0) (pg. 124)
19. Nullable Types over Value Types (pg. 126)
20. Exceptions (pg. 128)
21. Threads, Concurrent Execution, and Synchronization (pg. 130)
21.1 Threads and Concurrent Execution (pg. 130)
21.2 Locks and the lock Statement (pg. 132)
21.3 Operations on Threads (pg. 134)
21.4 Operations on Locked Objects (pg. 134)
22. Task Parallel Library (C# 4.0) (pg. 136)
22.1 Class Parallel (pg. 136)
22.2 The Task Classes (pg. 138)
23. Asynchronous Methods: async and await (C# 5.0) (pg. 142)
24. Mathematical Functions (pg. 144)
25. Input and Output (pg. 146)
25.1 Creating Streams (pg. 146)
25.2 Overview of Input and Output Methods (pg. 148)
25.3 Using Declarations, Exceptions, Thread Safety (pg. 148)
25.4 Sequential Character Input: TextReaders (pg. 150)
25.5 Sequential Character Output: TextWriters (pg. 152)
25.6 Binary Input and Output: BinaryReader and BinaryWriter (pg. 154)
25.7 Byte Input and Output: Stream (pg. 156)
25.8 Directories (pg. 160)
25.9 Files (pg. 160)
25.10 Network Communication (pg. 162)
26. Generic Types and Methods (pg. 164)
26.1 Generics: Safety, Generality, and Efficiency (pg. 164)
26.2 Generic Types, Type Parameters, and Constructed Types (pg. 164)
26.3 Generic Classes (pg. 166)
26.4 Constraints on Type Parameters (pg. 168)
26.5 Generic Interfaces (pg. 170)
26.7 Generic Methods (pg. 172)
26.8 Generic Delegate Types (pg. 174)
26.9 Abbreviations for Constructed Types (pg. 174)
26.10 Generic Struct Types (pg. 176)
26.11 The Implementation of Generic Types and Methods (pg. 176)
26.12 Variance of Type Parameters (C# 4.0) (pg. 178)
27. Generic Collections: Sets, Lists, and Dictionaries (pg. 180)
27.1 The ICollection<T> Interface (pg. 180)
27.2 Enumerators and Enumerables (pg. 182)
27.3 Comparables, Equatables, Comparers, and EqualityComparers (pg. 184)
27.4 The IList<T> Interface (pg. 186)
27.5 The IDictionary<K,V> Interface (pg. 186)
27.6 The List<T> Class (pg. 188)
27.7 The Dictionary<K,V> and SortedDictionary<K,V> Classes (pg. 190)
27.8 The KeyValuePair<K,V> Struct Type (pg. 190)
27.9 The ISet<T> Interface and the HashSet<T> and SortedSet<T> Classes (pg. 190)
27.10 The Queue<T> Class (pg. 192)
27.11 The Stack<T> Class (pg. 192)
28. Linq, Language Integrated Query (C# 3.0) (pg. 194)
28.1 Linq Expressions (C# 3.0) (pg. 194)
28.2 The Query Expression Pattern (pg. 198)
28.3 Differences between Linq and SQL (pg. 200)
28.4 Auxiliary Interfaces That Support Linq (C# 3.0) (pg. 200)
28.5 Extension Methods on IEnumerable<T> (C# 3.0) (pg. 202)
28.6 Numeric Extension Methods on IEnumerable<T> (C# 3.0) (pg. 208)
28.7 Extension Methods on IOrderedEnumerable<T> (C# 3.0) (pg. 208)
28.8 Extension Methods on Non-generic Enumerable (C# 3.0) (pg. 209)
28.9 Static Methods to Generate Enumerables (C# 3.0) (pg. 209)
29. Namespaces (pg. 210)
29.1 The using Directive (pg. 210)
30. Partial Type Declarations (pg. 212)
31. Assertions and the Debug.Assert Method (pg. 214)
32. Attributes (pg. 216)
32.1 Some Predefined Attributes (pg. 216)
32.2 Declaring and Using Custom Attributes (pg. 216)
33. Main Differences between C# and Java (pg. 218)
34. Resources (pg. 220)
Index (pg. 221)

Peter Sestoft

Peter Sestoft is Professor of Computer Science and Head of the Software and Systems Section at the IT University of Copenhagen.



eTextbook
Go paperless today! Available online anytime, nothing to download or install.

Features

  • Bookmarking
  • Note taking
  • Highlighting