コード例 #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Category?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ ContentId.GetHashCode();
         hashCode = (hashCode * 397) ^ (Description?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (IconImageUrl?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ Id.GetHashCode();
         hashCode = (hashCode * 397) ^ (Levels?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Name?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (RequiredLevels?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Reward?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)Type;
         return(hashCode);
     }
 }
コード例 #2
0
        public bool Equals(Commendation other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(Equals(Category, other.Category) &&
                   ContentId.Equals(other.ContentId) &&
                   string.Equals(Description, other.Description) &&
                   string.Equals(IconImageUrl, other.IconImageUrl) &&
                   Id.Equals(other.Id) &&
                   Levels.OrderBy(l => l.Id).SequenceEqual(other.Levels.OrderBy(l => l.Id)) &&
                   string.Equals(Name, other.Name) &&
                   RequiredLevels.OrderBy(rl => rl.Id).SequenceEqual(other.RequiredLevels.OrderBy(rl => rl.Id)) &&
                   Equals(Reward, other.Reward) &&
                   Type == other.Type);
        }