frostfs-sdk-csharp/src/FrostFS.SDK.Client/ApeRules/Resources.cs
Pavel Gross 32a7e64538 [#39] Client: add memory usage optimizations
Signed-off-by: Pavel Gross <p.gross@yadro.com>
2025-03-07 15:29:45 +03:00

36 lines
910 B
C#

namespace FrostFS.SDK.Client;
public struct Resources(bool inverted, string[] names) : System.IEquatable<Resources>
{
public bool Inverted { get; set; } = inverted;
public string[] Names { get; set; } = names;
public override readonly bool Equals(object obj)
{
if (obj == null || obj is not Resources)
return false;
return Equals((Resources)obj);
}
public override readonly int GetHashCode()
{
return Inverted.GetHashCode() ^ string.Join(string.Empty, Names).GetHashCode();
}
public static bool operator ==(Resources left, Resources right)
{
return left.Equals(right);
}
public static bool operator !=(Resources left, Resources right)
{
return !(left == right);
}
public readonly bool Equals(Resources other)
{
return this.GetHashCode().Equals(other.GetHashCode());
}
}