| | | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | | 2 | | // Licensed under the MIT License. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | |
| | | 6 | | namespace Azure.Storage.Blobs.Models |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// Blob info from a FindBlobsByTags. |
| | | 10 | | /// </summary> |
| | | 11 | | public class TaggedBlobItem : IEquatable<TaggedBlobItem> |
| | | 12 | | { |
| | | 13 | | /// <summary> |
| | | 14 | | /// Blob Name. |
| | | 15 | | /// </summary> |
| | 70 | 16 | | public string BlobName { get; internal set; } |
| | | 17 | | |
| | | 18 | | /// <summary> |
| | | 19 | | /// Container Name. |
| | | 20 | | /// </summary> |
| | 0 | 21 | | public string BlobContainerName { get; internal set; } |
| | | 22 | | |
| | | 23 | | /// <summary> |
| | | 24 | | /// Prevent direct instantiation of FilterBlobItem instances. |
| | | 25 | | /// You can use BlobsModelFactory.FilterBlobItem instead. |
| | | 26 | | /// </summary> |
| | 84 | 27 | | internal TaggedBlobItem() { } |
| | | 28 | | |
| | | 29 | | /// <summary> |
| | | 30 | | /// Check if two TaggedBlobItem instances are equal. |
| | | 31 | | /// </summary> |
| | | 32 | | /// <param name="left"> |
| | | 33 | | /// The first instance to compare. |
| | | 34 | | /// </param> |
| | | 35 | | /// <param name="right"> |
| | | 36 | | /// The first instance to compare. |
| | | 37 | | /// </param> |
| | | 38 | | /// <returns> |
| | | 39 | | /// True if they're equal, false otherwise. |
| | | 40 | | /// </returns> |
| | 0 | 41 | | public static bool operator ==(TaggedBlobItem left, TaggedBlobItem right) => left.Equals(right); |
| | | 42 | | |
| | | 43 | | /// <summary> |
| | | 44 | | /// Check if two TaggedBlobItem instances are not equal. |
| | | 45 | | /// </summary> |
| | | 46 | | /// <param name="left"> |
| | | 47 | | /// The first instance to compare. |
| | | 48 | | /// </param> |
| | | 49 | | /// <param name="right"> |
| | | 50 | | /// The first instance to compare. |
| | | 51 | | /// </param> |
| | | 52 | | /// <returns> |
| | | 53 | | /// True if they're not equal, false otherwise. |
| | | 54 | | /// </returns> |
| | 0 | 55 | | public static bool operator !=(TaggedBlobItem left, TaggedBlobItem right) => !(left == right); |
| | | 56 | | |
| | | 57 | | /// <summary> |
| | | 58 | | /// Checks if two TaggedBlobItem are equal to each other. |
| | | 59 | | /// </summary> |
| | | 60 | | /// <param name="obj">The other instance to compare to.</param> |
| | | 61 | | public override bool Equals(object obj) |
| | 0 | 62 | | => obj is TaggedBlobItem other && Equals(other); |
| | | 63 | | |
| | | 64 | | /// <summary> |
| | | 65 | | /// Get a hash code for the TaggedBlobItem. |
| | | 66 | | /// </summary> |
| | | 67 | | /// <returns>Hash code for the TaggedBlobItem.</returns> |
| | | 68 | | public override int GetHashCode() |
| | 0 | 69 | | => BlobName.GetHashCode() |
| | 0 | 70 | | ^ BlobContainerName.GetHashCode(); |
| | | 71 | | |
| | | 72 | | /// <summary> |
| | | 73 | | /// Checks if two TaggedBlobItem are equal to each other. |
| | | 74 | | /// </summary> |
| | | 75 | | /// <param name="other"> |
| | | 76 | | /// The other instance to compare to. |
| | | 77 | | /// </param> |
| | | 78 | | /// <returns></returns> |
| | | 79 | | public bool Equals(TaggedBlobItem other) |
| | 0 | 80 | | => BlobName == other.BlobName |
| | 0 | 81 | | && BlobContainerName == other.BlobContainerName; |
| | | 82 | | } |
| | | 83 | | } |