Chapter 2. C# 2

This chapter covers
  • Using generic types and methods for flexible, safe code
  • Expressing the absence of information with nullable value types
  • Constructing delegates relatively easily
  • Implementing iterators without writing boilerplate code

If your experience with C# goes far enough back, this chapter will be a reminder of just how far we’ve come and a prompt to be grateful for a dedicated and smart language design team. If you’ve never programmed C# without generics, you may end up wondering how C# ever took off without these features.[1] Either way, you may still find features you weren’t aware of or details you’ve never considered listed here.

1

For me, the answer to this one is simple: C# 1 was a more ...

Get C# in Depth, Fourth 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.