13.07.2015 Views

C# in Depth

C# in Depth

C# in Depth

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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Summary229typed local variables—are somewhat different. Likewise, most of the features wouldhave been useful <strong>in</strong>dividually <strong>in</strong> <strong>C#</strong> 2, whereas implicitly typed arrays and anonymoustypes only pay back the cost of learn<strong>in</strong>g about them when the rest of the <strong>C#</strong> 3 featuresare brought <strong>in</strong>to play.So what do these features really have <strong>in</strong> common? They all relieve the developer oftedious cod<strong>in</strong>g. I’m sure you don’t enjoy writ<strong>in</strong>g trivial properties any more than I do, orsett<strong>in</strong>g several properties, one at a time, us<strong>in</strong>g a local variable—particularly whenyou’re try<strong>in</strong>g to build up a collection of similar objects. Not only do the new featuresof <strong>C#</strong> 3 make it easier to write the code, they also make it easier to read it too, at leastwhen they’re applied sensibly.In our next chapter we’ll look at a major new language feature, along with a frameworkfeature it provides direct support for. If you thought anonymous methods madecreat<strong>in</strong>g delegates easy, just wait until you see lambda expressions…Licensed to Rhona Hadida

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

Saved successfully!

Ooh no, something went wrong!