Value Object

An object defined only by its values; two with equal values are equal.

What is Value Object?

A value object is defined only by its values, not by an identity. Two Money(10, "USD") objects are equal because their values match. Value objects are usually immutable.

public record Money(decimal Amount, string Currency);

Console.WriteLine(new Money(10, "USD") == new Money(10, "USD")); // True

Level: Journeyman · More OOP terms at this level

Updated