The power and elegance of generic types have long been acknowledged. Generics allow developers to parameterize data types much like you would parameterize a method. This brings a new dimension of reusability to your types without compromising expressiveness, type-safety, or efficiency. Now .NET gene
Professional .NET 2.0 Generics
โ Scribed by Tod Golding
- Publisher
- Wrox/Wiley Pub
- Year
- 2005
- Tongue
- English
- Leaves
- 410
- Series
- Wrox professional guides \ Programmer to Programmer
- Category
- Library
No coin nor oath required. For personal study only.
โฆ Synopsis
The power and elegance of generic types have long been acknowledged. Generics allow developers to parameterize data types much like you would parameterize a method. This brings a new dimension of reusability to your types without compromising expressiveness, type-safety, or efficiency. Now .NET generics makes this power available to all .NET developers. By introducing generic concepts directly into the Common Language Runtime (CLR), Microsoft has also created the first language-independent generics implementation. The result is a solution that allows generic types to be leveraged by all the languages of the .NET platform.
This book explores all aspects of the .NET generics implementation, covering everything from fundamental generic concepts, to the elements of generic syntax, to a broader view of how and when you might apply generics. It digs into the details associated with creating and consuming your own generic classes, structures, methods, delegates, and interfaces, examining all the nuances associated with leveraging each of these language constructs. The book also looks at guidelines for working with generic types, the performance gains achieved with generics, the new generic container libraries (BCL and third party), and key aspects of the underlying .NET implementation.
For those transitioning from C++, the book provides an in-depth look at the similarities and differences between templates and.NET generics. It also explores the syntactic variations associated with using generics with each of the .NET languages, including C#, Visual Basic, J#, and C++.
โฆ Table of Contents
Cover......Page 1
About the Author......Page 5
Acknowledgments......Page 7
Contents......Page 9
Not Just Syntax Candy......Page 17
What Does This Book Cover?......Page 18
Language Considerations......Page 19
Synopsis......Page 20
Conventions......Page 22
p2p.wrox.com......Page 23
Why Generics?......Page 25
Terminology......Page 38
Summary......Page 41
Motivation......Page 43
Least Common Denominator Programming......Page 44
A Basic Example......Page 45
Safety vs. Clarity......Page 56
Summary......Page 57
Shared Concepts......Page 59
Run-Time vs. Compile-Time......Page 60
Templates Extras......Page 67
Mix and Match Nirvana......Page 68
Summary......Page 69
Parameterizing Types......Page 71
Inheritance......Page 76
Fields......Page 80
Methods......Page 84
Nested Classes......Page 91
Consuming Generic Classes......Page 93
The Default Keyword......Page 97
System.Nullable
Accessing Type Info......Page 100
Indexers, Properties, and Events......Page 101
Generic Structs......Page 104
Generic Interfaces......Page 105
Summary......Page 106
The Basics......Page 107
A Deeper Look......Page 109
Apply Constraints......Page 111
Overloading Generic Methods......Page 112
Overriding Generic Methods......Page 116
Type Inference......Page 119
Generic Methods and Delegates......Page 120
Type-Safe Database Access Example......Page 121
Summary......Page 122
Delegate Basics......Page 123
Adding Generics to the Equation......Page 126
Event Handling......Page 129
Delegates in the Framework......Page 130
Type Coercion......Page 131
Applying Constraints......Page 132
Summary......Page 133
Overview......Page 135
Constraint Types......Page 139
Boxing and Constraints......Page 143
Using Multiple Constraints......Page 146
Generic Delegate and Method Constraints......Page 149
Inheritance and Constraints......Page 150
Are Generics Generic?......Page 151
Summary......Page 152
Motivation......Page 153
The Big Picture......Page 154
Generic Collection Classes......Page 158
Testing Equality......Page 208
Summary......Page 209
Reflection......Page 211
Serialization......Page 226
Remoting......Page 235
Summary......Page 239
Defining Guidelines......Page 241
Identifying Generic Opportunities......Page 242
Balancing Readability with Expressiveness......Page 251
Using BCL Generic Types......Page 259
Applying Constraints......Page 260
The Kitchen Sink......Page 263
Summary......Page 266
Overview......Page 267
High-Level Goals......Page 268
IL Representation of Generic Types......Page 270
Specialization and Sharing......Page 272
Exact Run-Time Types......Page 278
Support for Polymorphic Recursion......Page 280
NGen and Generic Types......Page 281
Performance......Page 283
Memory Footprint......Page 285
Summary......Page 286
Templates or Generics?......Page 287
Generic Classes in C++......Page 288
Generic Methods in C++......Page 292
Generic Interfaces in C++......Page 294
Constraints......Page 295
Generic Delegates in C++......Page 297
Mixing Generics and Templates......Page 298
STL.NET......Page 301
Summary......Page 302
J# Generic Limitations......Page 303
Consuming Generic Types......Page 304
Leveraging Cross-Language Support......Page 305
Working with Interfaces......Page 307
Complying with Constraints......Page 309
Calling Generic Methods......Page 311
Java Type Arguments......Page 312
Arrays of Generic Types......Page 313
Summary......Page 314
A Little History......Page 315
The Big Picture......Page 316
Class Reference......Page 320
Summary......Page 391
Index......Page 393
๐ SIMILAR VOLUMES
The power and elegance of generic types have long been acknowledged. Generics allow developers to parameterize data types much like you would parameterize a method. This brings a new dimension of reusability to your types without compromising expressiveness, type-safety, or efficiency. Now .NET gene
The power and elegance of generic types have long been acknowledged. Generics allow developers to parameterize data types much like you would parameterize a method. This brings a new dimension of reusability to your types without compromising expressiveness, type-safety, or efficiency. Now .NET gene
For developers experienced with Microsoft or Java platforms who want to program with the .NET Framework and CLR, this book looks at the underlying platform commonalities developers can use, regardless of language choice or development tools.
All new, for ASP.NET 2.0, this bestselling book provides experienced developers with real-world examples of the powerful new time-saving, code-saving features in this new version. Seasoned author and International .NET Association founder Bill Evjen along with Scott Hanselman help developers make a