Value object - is an unchangeable object that has attributes, but no distinct identity. In DDD it is very important to distinguish between Entities and Value Objects. The main difference between Entity and ValueObject is in the method Equals. Two entities are considered equal if their identifiers are equal. The ValueObject has no identifier. Two ValueObjects are considered equal if all their public properties are equal in value.
Example of value object:
publicclassAddress:ValueObject<Address>{publicstring City { get; set; }publicstring Street { get; set; }publicstring House { get; set; }}
bool isEqual;var address1 =newAddress { City ="Moscow", Street ="Prospekt Mira", House ="57" };var address2 =newAddress { City ="Moscow", Street ="Prospekt Mira", House ="57" };var address3 =newAddress { City ="Volgograd", Street ="Prospekt Mira", House ="57" };isEqual = address1 == address2; // Returns "true"isEqual = address1 == address3; // Returns "false" because of different cities