Table of Contents

Class ValueObject

Namespace
Compendium.Core.Domain.Primitives
Assembly
Compendium.Core.dll

Base class for value objects in the domain. Provides structural equality based on component values.

public abstract class ValueObject : IEquatable<ValueObject>
Inheritance
ValueObject
Implements
Derived
Inherited Members

Methods

Equals(ValueObject?)

Determines whether the specified value object is equal to the current value object.

public bool Equals(ValueObject? other)

Parameters

other ValueObject

The value object to compare with the current value object.

Returns

bool

true if the specified value object is equal to the current value object; otherwise, false.

Equals(object?)

Determines whether the specified object is equal to the current value object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current value object.

Returns

bool

true if the specified object is equal to the current value object; otherwise, false.

GetEqualityComponents()

Gets the equality components that define the value object's identity.

protected abstract IEnumerable<object?> GetEqualityComponents()

Returns

IEnumerable<object>

An enumerable of objects that participate in equality comparison.

GetHashCode()

Returns the hash code for this value object.

public override int GetHashCode()

Returns

int

A hash code for the current value object.

ToString()

Returns a string representation of the value object.

public override string ToString()

Returns

string

A string that represents the current value object.

Operators

operator ==(ValueObject?, ValueObject?)

Determines whether two value objects are equal.

public static bool operator ==(ValueObject? left, ValueObject? right)

Parameters

left ValueObject

The first value object to compare.

right ValueObject

The second value object to compare.

Returns

bool

true if the value objects are equal; otherwise, false.

operator !=(ValueObject?, ValueObject?)

Determines whether two value objects are not equal.

public static bool operator !=(ValueObject? left, ValueObject? right)

Parameters

left ValueObject

The first value object to compare.

right ValueObject

The second value object to compare.

Returns

bool

true if the value objects are not equal; otherwise, false.