43 lines
1 KiB
C#
43 lines
1 KiB
C#
namespace FrostFS.SDK.Client;
|
|
|
|
public struct Condition : System.IEquatable<Condition>
|
|
{
|
|
public ConditionType Op { get; set; }
|
|
|
|
public ConditionKindType Kind { get; set; }
|
|
|
|
public string? Key { get; set; }
|
|
|
|
public string? Value { get; set; }
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
if (obj == null || obj is not Condition)
|
|
return false;
|
|
|
|
return Equals((Condition)obj);
|
|
}
|
|
|
|
public override readonly int GetHashCode()
|
|
{
|
|
return Op.GetHashCode()
|
|
^ Kind.GetHashCode()
|
|
^ (Key != null ? Key.GetHashCode() : 0)
|
|
^ (Value != null ? Value.GetHashCode() : 0);
|
|
}
|
|
|
|
public static bool operator ==(Condition left, Condition right)
|
|
{
|
|
return left.Equals(right);
|
|
}
|
|
|
|
public static bool operator !=(Condition left, Condition right)
|
|
{
|
|
return !(left == right);
|
|
}
|
|
|
|
public readonly bool Equals(Condition other)
|
|
{
|
|
return this.GetHashCode().Equals(other.GetHashCode());
|
|
}
|
|
}
|