13.07.2015 Views

C# in Depth

C# in Depth

C# in Depth

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CONTENTSxiii7.7 Expos<strong>in</strong>g <strong>in</strong>ternal members to selected assemblies 201Friend assemblies <strong>in</strong> the simple case 201 ■ Why useInternalsVisibleTo? 202 ■ InternalsVisibleTo and signedassemblies 2037.8 Summary 204PART 3 <strong>C#</strong> 3—REVOLUTIONIZING HOW WE CODE .......20589Cutt<strong>in</strong>g fluff with a smart compiler 2078.1 Automatically implemented properties 2088.2 Implicit typ<strong>in</strong>g of local variables 210Us<strong>in</strong>g var to declare a local variable 211 ■ Restrictionson implicit typ<strong>in</strong>g 212 ■ Pros and cons of implicittyp<strong>in</strong>g 213 ■ Recommendations 2148.3 Simplified <strong>in</strong>itialization 215Def<strong>in</strong><strong>in</strong>g our sample types 215 ■ Sett<strong>in</strong>g simple properties 216Sett<strong>in</strong>g properties on embedded objects 218 ■ Collection<strong>in</strong>itializers 218 ■ Uses of <strong>in</strong>itialization features 2218.4 Implicitly typed arrays 2238.5 Anonymous types 224First encounters of the anonymous k<strong>in</strong>d 224 ■ Membersof anonymous types 226 ■ Projection <strong>in</strong>itializers 226What’s the po<strong>in</strong>t? 2278.6 Summary 228Lambda expressions and expression trees 2309.1 Lambda expressions as delegates 232Prelim<strong>in</strong>aries: <strong>in</strong>troduc<strong>in</strong>g the Func delegate types 232First transformation to a lambda expression 232 ■ Us<strong>in</strong>g as<strong>in</strong>gle expression as the body 234 ■ Implicitly typed parameterlists 234 ■ Shortcut for a s<strong>in</strong>gle parameter 2349.2 Simple examples us<strong>in</strong>g List and events 235Filter<strong>in</strong>g, sort<strong>in</strong>g, and actions on lists 236 ■ Logg<strong>in</strong>g <strong>in</strong>an event handler 2379.3 Expression trees 238Build<strong>in</strong>g expression trees programmatically 239 ■ Compil<strong>in</strong>g expressiontrees <strong>in</strong>to delegates 240 ■ Convert<strong>in</strong>g <strong>C#</strong> lambda expressions toexpression trees 241 ■ Expression trees at the heart of LINQ 244Licensed to Rhona Hadida

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!