About the Author |
|
xiii | |
About the Technical Reviewer |
|
xv | |
Acknowledgments |
|
xvii | |
Introduction |
|
xix | |
|
|
1 | (88) |
|
Chapter 1 Fundamentals of NET and C# |
|
|
3 | (30) |
|
|
3 | (1) |
|
|
3 | (4) |
|
Preliminary Concepts in C# |
|
|
7 | (5) |
|
|
12 | (1) |
|
Basic Programming Concepts |
|
|
12 | (7) |
|
|
19 | (5) |
|
|
24 | (1) |
|
|
25 | (4) |
|
|
29 | (2) |
|
|
31 | (2) |
|
Chapter 2 Strings and Arrays |
|
|
33 | (26) |
|
|
34 | (1) |
|
|
34 | (4) |
|
|
38 | (5) |
|
|
43 | (1) |
|
|
43 | (10) |
|
|
53 | (6) |
|
Chapter 3 Enumeration and Structure Types |
|
|
59 | (30) |
|
|
60 | (1) |
|
|
60 | (3) |
|
|
63 | (4) |
|
Limitations of Using Structures in C# |
|
|
67 | (1) |
|
|
68 | (1) |
|
The enum Type Fundamentals |
|
|
68 | (9) |
|
Reviewing the Flags Enumeration |
|
|
77 | (1) |
|
The struct Type Fundamentals |
|
|
78 | (6) |
|
Testing the Default Value Expression |
|
|
84 | (2) |
|
Discussion About a C# 11 Feature |
|
|
86 | (1) |
|
Testing a Nondestructive Mutation |
|
|
87 | (2) |
|
Part II Object-Oriented Programming |
|
|
89 | (180) |
|
Chapter 4 Classes and Objects |
|
|
91 | (20) |
|
|
91 | (1) |
|
|
91 | (2) |
|
|
93 | (3) |
|
|
96 | (2) |
|
|
98 | (1) |
|
Basic Concepts and Use of Constructors |
|
|
98 | (3) |
|
Optional Parameters and Object Initializers |
|
|
101 | (2) |
|
Visibility Control Basics |
|
|
103 | (1) |
|
|
104 | (2) |
|
|
106 | (5) |
|
|
111 | (36) |
|
|
111 | (1) |
|
|
112 | (1) |
|
|
112 | (4) |
|
Different Aspects of Inheritance |
|
|
116 | (6) |
|
|
122 | (1) |
|
|
122 | (6) |
|
Analyzing the sealed Keyword |
|
|
128 | (2) |
|
|
130 | (6) |
|
|
136 | (6) |
|
|
142 | (1) |
|
Covariance and Contravariance |
|
|
143 | (4) |
|
|
147 | (36) |
|
|
148 | (1) |
|
|
148 | (4) |
|
|
152 | (1) |
|
|
153 | (4) |
|
|
157 | (1) |
|
|
157 | (4) |
|
Abstract Class Case Studies |
|
|
161 | (6) |
|
|
167 | (13) |
|
|
180 | (3) |
|
Chapter 7 Encapsulation Using Properties and Indexers |
|
|
183 | (30) |
|
|
184 | (2) |
|
|
186 | (1) |
|
Alternative Code to Create a Property |
|
|
187 | (2) |
|
|
189 | (3) |
|
|
192 | (1) |
|
|
193 | (3) |
|
Virtual and Abstract Properties |
|
|
196 | (3) |
|
The Usage of the init Keyword |
|
|
199 | (3) |
|
|
202 | (1) |
|
Properties and Indexers in Interfaces |
|
|
203 | (5) |
|
|
208 | (5) |
|
Chapter 8 Handling Exceptions |
|
|
213 | (26) |
|
|
213 | (1) |
|
|
214 | (5) |
|
|
219 | (1) |
|
|
220 | (2) |
|
|
222 | (1) |
|
|
222 | (1) |
|
Using Multiple Catch Blocks |
|
|
223 | (6) |
|
Using a General Catch Block |
|
|
229 | (2) |
|
Throwing and Rethrowing an Exception |
|
|
231 | (6) |
|
|
237 | (2) |
|
Chapter 9 Useful Concepts |
|
|
239 | (30) |
|
|
239 | (1) |
|
|
239 | (4) |
|
|
243 | (1) |
|
|
244 | (3) |
|
|
247 | (1) |
|
|
247 | (2) |
|
|
249 | (1) |
|
|
250 | (1) |
|
|
250 | (3) |
|
|
253 | (4) |
|
Passing the Value-Type by Value |
|
|
257 | (1) |
|
Passing the Value-Type by Reference |
|
|
258 | (2) |
|
|
260 | (1) |
|
|
261 | (2) |
|
A Method That Returns Multiple Values |
|
|
263 | (1) |
|
Comparing the const and readonly Keywords |
|
|
264 | (4) |
|
|
268 | (1) |
|
|
269 | (186) |
|
|
271 | (24) |
|
|
271 | (1) |
|
|
272 | (6) |
|
|
278 | (5) |
|
|
283 | (1) |
|
|
283 | (3) |
|
|
286 | (2) |
|
|
288 | (2) |
|
|
290 | (2) |
|
|
292 | (3) |
|
|
295 | (24) |
|
|
297 | (1) |
|
|
297 | (4) |
|
Different Aspects of Using Events |
|
|
301 | (1) |
|
|
302 | (1) |
|
|
303 | (1) |
|
|
304 | (3) |
|
|
307 | (4) |
|
|
311 | (4) |
|
|
315 | (4) |
|
Chapter 12 Lambda Expressions |
|
|
319 | (26) |
|
|
319 | (1) |
|
|
320 | (4) |
|
Types of Lambda Expressions |
|
|
324 | (1) |
|
|
325 | (1) |
|
|
326 | (1) |
|
|
326 | (1) |
|
Expression-Bodied Members |
|
|
327 | (4) |
|
Local Variables in Lambda Expressions |
|
|
331 | (1) |
|
Tuples in Lambda Expressions |
|
|
332 | (3) |
|
|
335 | (4) |
|
|
339 | (1) |
|
|
340 | (1) |
|
|
341 | (4) |
|
|
345 | (40) |
|
|
346 | (1) |
|
|
346 | (2) |
|
|
348 | (1) |
|
|
349 | (2) |
|
|
351 | (1) |
|
|
352 | (1) |
|
|
352 | (1) |
|
Finding the Default Values |
|
|
353 | (4) |
|
Implementing a Generic Interface |
|
|
357 | (2) |
|
Understanding Generic Constraints |
|
|
359 | (8) |
|
|
367 | (4) |
|
|
371 | (6) |
|
Self-Referencing Generic Type |
|
|
377 | (2) |
|
Testing Overloading and Overriding |
|
|
379 | (4) |
|
|
383 | (2) |
|
|
385 | (46) |
|
|
386 | (1) |
|
|
386 | (3) |
|
|
389 | (2) |
|
|
391 | (1) |
|
|
391 | (2) |
|
|
393 | (2) |
|
|
395 | (1) |
|
|
395 | (3) |
|
Understanding the Doin() Method |
|
|
398 | (3) |
|
Handling Parameterized Methods |
|
|
401 | (6) |
|
|
407 | (4) |
|
Foreground vs. Background Threads |
|
|
411 | (2) |
|
Understanding Thread Synchronization |
|
|
413 | (5) |
|
|
418 | (3) |
|
|
421 | (5) |
|
Managed Thread Cancellation |
|
|
426 | (5) |
|
|
431 | (24) |
|
|
431 | (1) |
|
|
431 | (2) |
|
|
433 | (1) |
|
Partial Classes and Methods |
|
|
434 | (2) |
|
|
436 | (1) |
|
|
437 | (7) |
|
|
444 | (4) |
|
|
448 | (2) |
|
|
450 | (5) |
Appendix A A Final Note |
|
455 | (1) |
A Personal Appeal |
|
455 | (2) |
Appendix B Recommended Reading |
|
457 | (2) |
Index |
|
459 | |