6 THE NATURE OF VALUES

C# gives special meaning to the term value type, but the concept of a value certainly isn’t unique to C#. In this chapter, we’ll revisit values more generally and identify some key characteristics that indicate whether we should implement something as a value type. We’ll look at the unique and important role of values and value types in our programs, and how implementing a well-behaved value type requires more than just using a struct or a record struct.

We’ll explore the following:

  • How to improve our designs by employing value type objects to encapsulate behavior
  • How overriding the native reference semantics for ...

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.