|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RuleOfReady.Core.DomainModels
{
public class PartialSequenceComparer : IEqualityComparer<MahjongPartialSequence>
{
public bool Equals(MahjongPartialSequence x, MahjongPartialSequence y)
{
if (Object.ReferenceEquals(x, null))
return false;
if (Object.ReferenceEquals(y, this))
return true;
bool isSame = (x.PartialSequence.SequenceEqual(y.PartialSequence));
return isSame;
}
public int GetHashCode(MahjongPartialSequence obj)
{
int hashCode = 0;
foreach (MahjongTile tile in obj.PartialSequence)
hashCode ^= tile.GetHashCode();
return hashCode;
}
}
}
|
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 a software developer that works with a small team on websites in .Net. Software development is a career of constant learning, and here I'm learning by sharing.