Chapter 13. Minor changes to simplify code

This chapter covers

  • Optional parameters
  • Named arguments
  • Streamlining ref parameters in COM
  • Embedding COM primary interop assemblies
  • Calling named indexers declared in COM
  • Generic variance for interfaces and delegates
  • Changes in locking and field-like events

Just as in previous versions, C# 4 has a few minor features that don’t merit individual chapters to themselves. In fact, there’s only one really big feature in C# 4—dynamic typing—which we’ll cover in the next chapter. The changes we’ll cover here just make C# that little bit more pleasant to work with, particularly if you work with COM on a regular basis. These features generally make code clearer, remove drudgery from COM calls, or simplify ...

Get C# in Depth, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.