-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLockTokenIdPair.cs
44 lines (32 loc) · 1.07 KB
/
LockTokenIdPair.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
namespace ChasterUtil;
public sealed class LockTokenIdPair(string lockId, string tokenId) : IEquatable<LockTokenIdPair>
{
public string LockId => lockId;
public string TokenId => tokenId;
#region Equality
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is LockTokenIdPair other && LockId == other.LockId && TokenId == other.TokenId;
}
public bool Equals(LockTokenIdPair? other)
{
return ReferenceEquals(this, other) || other is not null && LockId == other.LockId && TokenId == other.TokenId;
}
public override int GetHashCode()
{
return HashCode.Combine(LockId, TokenId);
}
public static bool operator ==(LockTokenIdPair? obj1, LockTokenIdPair? obj2)
{
if (ReferenceEquals(obj1, obj2))
return true;
if (obj1 is null || obj2 is null)
return false;
return obj1.Equals(obj2);
}
public static bool operator !=(LockTokenIdPair? obj1, LockTokenIdPair? obj2)
{
return !(obj1 == obj2);
}
#endregion
}