public bool Equals(ImageThumbnail other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(Id == other.Id && SizeBytes == other.SizeBytes && MD5Hash == other.MD5Hash && Width == other.Width && Height == other.Height && Name == other.Name && MimeType == other.MimeType && DateAddedUtc.Equals(other.DateAddedUtc)); }
public bool Equals(ImageMetadata other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } bool primitivePropertiesEqual = PartitionKey == other.PartitionKey && Id == other.Id && SizeBytes == other.SizeBytes && MD5Hash == other.MD5Hash && Width == other.Width && Height == other.Height && DateAddedUtc.Equals(other.DateAddedUtc) && Name == other.Name && MimeType == other.MimeType && ImageType == other.ImageType && FileExtension == other.FileExtension; bool tagsEqual = true; if (Tags != null && other.Tags != null && Tags.Count == other.Tags.Count) { foreach (var tag in Tags) { if (!other.Tags.TryGetValue(tag.Key, out var value) || tag.Value != value) { tagsEqual = false; break; } } } else if (Tags == null && other.Tags == null) { tagsEqual = true; } else { tagsEqual = false; } bool thumbnailsEqual = true; if (Thumbnails != null && other.Thumbnails != null && Thumbnails.Count == other.Thumbnails.Count) { for (var i = 0; i < Thumbnails.Count; i++) { var thumbnail = Thumbnails[i]; if (!thumbnail.Equals(other.Thumbnails[i])) { thumbnailsEqual = false; break; } } } else if (Thumbnails == null && other.Thumbnails == null) { thumbnailsEqual = true; } else { thumbnailsEqual = false; } return(primitivePropertiesEqual && tagsEqual && thumbnailsEqual); }