|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Signum.Utilities.DataStructures
{
[Serializable]
public struct MinMax<T> : IEquatable<MinMax<T>>
{
public readonly T Min;
public readonly T Max;
public MinMax(T min, T max)
{
this.Min = min;
this.Max = max;
}
public override string ToString()
{
return "[Min = {0}, Max = {1}]".Formato(Min, Max);
}
public bool Equals(MinMax<T> value)
{
return
EqualityComparer<T>.Default.Equals(Min, value.Min) &&
EqualityComparer<T>.Default.Equals(Max, value.Max);
}
public override bool Equals(object obj)
{
return obj is MinMax<T> && Equals((MinMax<T>)obj);
}
public override int GetHashCode()
{
int num = -722197669;
num = (-1521134295 * num) + EqualityComparer<T>.Default.GetHashCode(this.Min);
return (-1521134295 * num) + EqualityComparer<T>.Default.GetHashCode(this.Max);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I'm Computer Scientist, one of the founders of Signum Software, and the lead developer behind Signum Framework.
www.signumframework.com
I love programming in C#, Linq, Compilers, Algorithms, Functional Programming, Computer Graphics, Maths...