2 VALUE AND REFERENCE TYPES

We can create new types in C# in several ways, and we need to consider the individual characteristics of each approach to determine which best suits our goals. In particular, knowing how value types differ from reference types helps us choose the right way forward, because these differences have significant and sometimes unconsidered implications when we’re defining our own types. Certain trade-offs will affect how we design our type and what we can use it for. In this chapter, we’ll investigate those differences and what they mean for our programs.

We’ll explore the following:

  • What choices we have when creating ...

Get The C# Type System 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.