Class ValueObject
- Namespace
- Savvyio.Domain
- Assembly
- Savvyio.Domain.dll
Represents an object whose equality is based on the value rather than identity as specified in Domain Driven Design.
public abstract class ValueObject : IEquatable<ValueObject>
- Inheritance
-
ObjectValueObject
- Implements
-
IEquatable<ValueObject>
- Derived
Constructors
ValueObject()
Initializes a new instance of the ValueObject class.
protected ValueObject()
Methods
Equals(ValueObject)
Indicates whether the current object is equal to another object of the same type.
public virtual bool Equals(ValueObject other)
Parameters
other
ValueObjectAn object to compare with this object.
Returns
- Boolean
true if the current object is equal to the
other
parameter; otherwise, false.
GetEqualityComponents()
Gets the equality components of this instance. Default is all public properties having a simple signature.
protected virtual IEnumerable<object> GetEqualityComponents()
Returns
- IEnumerable<Object>
An System.Collections.Generic.IEnumerable<T> that contains the equality components of this instance.
GetHashCode()
Returns a hash code for this instance.
public override int GetHashCode()
Returns
- Int32
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
ToString()
Returns a System.String that represents this instance.
public override string ToString()
Returns
- String
A System.String that represents this instance.