Free mag vol1 | Page 20
CONTENTS
Understanding Lambda Expressions .............................................................................390
Dissecting a Lambda Expression.......................................................................................................... 393
Processing Arguments Within Multiple Statements ............................................................................. 394
Lambda Expressions with Multiple (or Zero) Parameters..................................................................... 395
Retrofitting the CarEvents Example Using Lambda Expressions.......................................................... 396
Summary .......................................................................................................................397
Chapter 11: Advanced C# Language Features ....................................................399
Understanding Indexer Methods....................................................................................399
Indexing Data Using String Values........................................................................................................ 401
Overloading Indexer Methods............................................................................................................... 403
Indexers with Multiple Dimensions ...................................................................................................... 403
Indexer Definitions on Interface Types ................................................................................................. 404
Understanding Operator Overloading ............................................................................404
Overloading Binary Operators............................................................................................................... 405
And What of the += and –+ Operators?............................................................................................... 408
Overloading Unary Operators................................................................................................................ 408
Overloading Equality Operators ............................................................................................................ 409
Overloading Comparison Operators...................................................................................................... 410
Final Thoughts Regarding Operator Overloading.................................................................................. 411
Understanding Custom Type Conversions .....................................................................412
Recall: Numerical Conversions............................................................................................................. 412
Recall: Conversions Among Related Class Types ................................................................................. 412
Creating Custom Conversion Routines ................................................................................................. 413
Additional Explicit Conversions for the Square Type ............................................................................ 416
Defining Implicit Conversion Routines.................................................................................................. 417
Understanding Extension Methods ................................................................................418
Defining Extension Methods ................................................................................................................. 418
Invoking Extension Methods................................................................................................................. 420
xviii