About the Author |
|
xiii | |
About the Technical Reviewer |
|
xv | |
Acknowledgments |
|
xvii | |
Foreword |
|
xix | |
Introduction |
|
xxi | |
|
Part I Getting Familiar with Building Blocks |
|
|
1 | (100) |
|
|
3 | (30) |
|
|
5 | (5) |
|
|
10 | (1) |
|
|
10 | (1) |
|
Comparing a Static Method with an Instance Method |
|
|
11 | (3) |
|
|
12 | (2) |
|
Using Multicast Delegates |
|
|
14 | (10) |
|
|
15 | (2) |
|
|
17 | (1) |
|
|
17 | (2) |
|
|
19 | (2) |
|
|
21 | (1) |
|
|
22 | (2) |
|
|
24 | (7) |
|
|
25 | (1) |
|
|
26 | (2) |
|
Contravariance in Delegates |
|
|
28 | (1) |
|
|
28 | (2) |
|
|
30 | (1) |
|
|
31 | (1) |
|
|
31 | (2) |
|
|
33 | (38) |
|
|
35 | (3) |
|
|
38 | (1) |
|
|
38 | (1) |
|
|
38 | (1) |
|
|
39 | (4) |
|
|
40 | (3) |
|
Passing Data to an Event Argument |
|
|
43 | (3) |
|
|
43 | (3) |
|
|
46 | (7) |
|
|
48 | (4) |
|
|
52 | (1) |
|
Handling Interface Events |
|
|
53 | (2) |
|
|
53 | (2) |
|
|
55 | (1) |
|
Handling Explicit Interface Events |
|
|
55 | (16) |
|
|
56 | (4) |
|
|
60 | (1) |
|
|
61 | (3) |
|
|
64 | (1) |
|
|
65 | (6) |
Final Words |
|
67 | (2) |
Summary |
|
69 | (320) |
|
Chapter 3 Lambda Expressions |
|
|
71 | (30) |
|
The Usefulness of Lambda Expressions |
|
|
71 | (5) |
|
|
72 | (4) |
|
Lambda Expression with (and Without) Parameters |
|
|
76 | (2) |
|
|
76 | (2) |
|
Types of Lambda Expressions |
|
|
78 | (1) |
|
Expression-Bodied Members |
|
|
78 | (7) |
|
|
80 | (2) |
|
|
82 | (3) |
|
Local Variables in a Lambda Expression |
|
|
85 | (3) |
|
|
86 | (2) |
|
Using Tuples in a Lambda Expression |
|
|
88 | (3) |
|
|
89 | (2) |
|
Event Subscription with Lambda Expressions |
|
|
91 | (8) |
|
|
91 | (3) |
|
|
94 | (5) |
|
|
99 | (1) |
|
|
99 | (2) |
|
Part II Exploring Advanced Programming |
|
|
101 | (240) |
|
Chapter 4 Generic Programming |
|
|
103 | (60) |
|
The Motivation Behind Generics |
|
|
103 | (9) |
|
|
104 | (3) |
|
|
107 | (3) |
|
|
110 | (2) |
|
A Quick Look into the List Class |
|
|
112 | (2) |
|
|
113 | (1) |
|
|
114 | (8) |
|
|
114 | (2) |
|
|
116 | (1) |
|
|
117 | (1) |
|
|
118 | (1) |
|
|
118 | (2) |
|
|
120 | (2) |
|
The Default Keyword in Generics |
|
|
122 | (3) |
|
|
122 | (2) |
|
|
124 | (1) |
|
Implementing Generic Interface |
|
|
125 | (4) |
|
|
125 | (3) |
|
|
128 | (1) |
|
|
129 | (6) |
|
|
130 | (3) |
|
|
133 | (2) |
|
Using Covariance and Contravariance |
|
|
135 | (3) |
|
|
137 | (1) |
|
Covariance with Generic Delegate |
|
|
138 | (3) |
|
|
139 | (2) |
|
Covariance with Generic Interfaces |
|
|
141 | (3) |
|
|
141 | (3) |
|
Contravariance with Generic Delegates |
|
|
144 | (3) |
|
|
145 | (2) |
|
Contravariance with Generic Interface |
|
|
147 | (7) |
|
|
148 | (1) |
|
|
148 | (1) |
|
|
149 | (2) |
|
|
151 | (1) |
|
|
152 | (2) |
|
Self-Referencing Generic Types |
|
|
154 | (8) |
|
|
155 | (3) |
|
|
158 | (1) |
|
|
159 | (2) |
|
|
161 | (1) |
|
|
162 | (1) |
|
|
162 | (1) |
|
Chapter 5 Thread Programming |
|
|
163 | (54) |
|
Foundations in Thread Programming |
|
|
163 | (3) |
|
|
166 | (1) |
|
Coding Multithreaded Programs in C# |
|
|
166 | (2) |
|
Using the ThreadStart Delegate |
|
|
168 | (11) |
|
|
170 | (4) |
|
|
174 | (4) |
|
|
178 | (1) |
|
Using the ParameterizedThreadStart Delegate |
|
|
179 | (17) |
|
|
179 | (4) |
|
|
183 | (1) |
|
|
184 | (6) |
|
|
190 | (1) |
|
|
190 | (2) |
|
|
192 | (1) |
|
|
193 | (2) |
|
|
195 | (1) |
|
Foreground Thread vs. Background Thread |
|
|
196 | (4) |
|
|
197 | (3) |
|
|
200 | (5) |
|
A Non-Synchronized Version |
|
|
200 | (1) |
|
|
201 | (2) |
|
|
203 | (1) |
|
|
203 | (2) |
|
An Alternative Approach Using the Monitor Class |
|
|
205 | (2) |
|
|
207 | (7) |
|
|
208 | (1) |
|
|
208 | (3) |
|
Investigating the Deadlocked State in Visual Studio |
|
|
211 | (3) |
|
|
214 | (2) |
|
|
216 | (1) |
|
Chapter 6 Asynchronous Programming |
|
|
217 | (66) |
|
|
217 | (2) |
|
Using a Synchronous Approach |
|
|
219 | (1) |
|
|
219 | (1) |
|
|
220 | (3) |
|
|
221 | (2) |
|
|
223 | (1) |
|
Using the ThreadPool Class |
|
|
223 | (6) |
|
|
225 | (4) |
|
|
229 | (1) |
|
Using Lambda Expressions with ThreadPool |
|
|
229 | (4) |
|
|
230 | (3) |
|
Using the lAsyncResult Pattern |
|
|
233 | (16) |
|
Polling Using Asynchronous Delegates |
|
|
233 | (1) |
|
|
233 | (4) |
|
|
237 | (1) |
|
Using the AsyncWaitHandle Property of lAsyncResult |
|
|
238 | (1) |
|
|
239 | (3) |
|
Using Asynchronous Callback |
|
|
242 | (1) |
|
|
243 | (3) |
|
|
246 | (3) |
|
Using an Event-based Asynchronous Pattern (EAP) |
|
|
249 | (9) |
|
|
250 | (7) |
|
|
257 | (1) |
|
|
258 | (4) |
|
|
260 | (2) |
|
Using a Task-based Asynchronous Pattern (TAP) |
|
|
262 | (19) |
|
|
262 | (2) |
|
|
264 | (5) |
|
|
269 | (1) |
|
Using the async and await Keywords |
|
|
270 | (2) |
|
|
272 | (5) |
|
|
277 | (4) |
|
|
281 | (1) |
|
|
281 | (2) |
|
Chapter 7 Database Programming |
|
|
283 | (58) |
|
|
284 | (6) |
|
|
285 | (1) |
|
|
285 | (1) |
|
|
286 | (4) |
|
A Brief Discussion of ADO.NET |
|
|
290 | (1) |
|
|
291 | (7) |
|
|
293 | (1) |
|
|
294 | (2) |
|
|
296 | (2) |
|
Implementing Connection-Oriented Architecture |
|
|
298 | (14) |
|
|
299 | (4) |
|
|
303 | (9) |
|
Implementing Disconnected Data Architecture |
|
|
312 | (11) |
|
|
313 | (2) |
|
|
315 | (1) |
|
|
316 | (7) |
|
Programming with Stored Procedures |
|
|
323 | (14) |
|
Stored Procedure to Select Records |
|
|
324 | (1) |
|
Stored Procedure to Insert One Record |
|
|
324 | (1) |
|
Stored Procedure to Delete One Record |
|
|
325 | (1) |
|
|
325 | (2) |
|
|
327 | (6) |
|
|
333 | (4) |
|
|
337 | (1) |
|
|
338 | (1) |
|
|
339 | (2) |
|
Appendix A Installing MySQL and Testing SQL Commands |
|
|
341 | (46) |
|
|
374 | (2) |
|
Testing the Installation and Executing Simple SQL Statements |
|
|
376 | (11) |
|
Appendix B Recommended Reading |
|
|
387 | (2) |
Index |
|
389 | |