$mermaidjs
Clean Architecture Demo
Loading...
Searching...
No Matches
ValueObject.cs
Go to the documentation of this file.
1
namespace
TaskManagement.Domain.Common
;
2
3
public
abstract
class
ValueObject
4
{
5
protected
abstract
IEnumerable<object?>
GetEqualityComponents
();
6
7
public
override
bool
Equals
(
object
? obj)
8
{
9
if
(obj is
null
|| obj.GetType() != GetType())
10
return
false
;
11
12
var other = (
ValueObject
)obj;
13
return
GetEqualityComponents
().SequenceEqual(other.GetEqualityComponents());
14
}
15
16
public
override
int
GetHashCode
()
17
{
18
return
GetEqualityComponents
()
19
.Aggregate(0, (current, component) =>
20
HashCode.Combine(current, component));
21
}
22
23
public
static
bool
operator ==
(
ValueObject
? left,
ValueObject
? right)
24
=>
Equals
(left, right);
25
26
public
static
bool
operator !=
(
ValueObject
? left,
ValueObject
? right)
27
=> !
Equals
(left, right);
28
}
TaskManagement.Domain.Common.ValueObject
Definition
ValueObject.cs:4
TaskManagement.Domain.Common.ValueObject.GetHashCode
override int GetHashCode()
Definition
ValueObject.cs:16
TaskManagement.Domain.Common.ValueObject.GetEqualityComponents
IEnumerable< object?> GetEqualityComponents()
TaskManagement.Domain.Common.ValueObject.operator!=
static bool operator!=(ValueObject? left, ValueObject? right)
TaskManagement.Domain.Common.ValueObject.Equals
override bool Equals(object? obj)
Definition
ValueObject.cs:7
TaskManagement.Domain.Common.ValueObject.operator==
static bool operator==(ValueObject? left, ValueObject? right)
TaskManagement.Domain.Common
Definition
Result.cs:2
src
TaskManagement.Domain
Common
ValueObject.cs
Generated by
1.9.8