-
Notifications
You must be signed in to change notification settings - Fork 4.5k
/
ArmSku.cs
95 lines (83 loc) · 3.38 KB
/
ArmSku.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.ComponentModel;
using System.Globalization;
using Azure.Core;
namespace Azure.ResourceManager.Models
{
/// <summary>
/// A class representing SKU for resource.
/// </summary>
public sealed partial class ArmSku : IEquatable<ArmSku>
{
/// <summary>
/// Compares this <see cref="ArmSku"/> instance with another object and determines if they are equals.
/// </summary>
/// <param name="other"> <see cref="ArmSku"/> object to compare. </param>
/// <returns> True if they are equals, otherwise false. </returns>
public bool Equals(ArmSku other)
{
if (other == null)
return false;
if (object.ReferenceEquals(this, other))
return true;
return string.Equals(Name, other.Name, StringComparison.InvariantCultureIgnoreCase) &&
string.Equals(Family, other.Family, StringComparison.InvariantCultureIgnoreCase) &&
string.Equals(Size, other.Size, StringComparison.InvariantCultureIgnoreCase) &&
(Tier.HasValue ? Tier.Value.Equals(other.Tier) : !other.Tier.HasValue) &&
long.Equals(Capacity, other.Capacity);
}
/// <inheritdoc/>
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object obj)
{
if (ReferenceEquals(this, obj))
{
return true;
}
if (ReferenceEquals(obj, null))
{
return false;
}
if (obj is not ArmSku other)
return false;
return Equals(other);
}
/// <inheritdoc/>
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode()
{
return HashCodeBuilder.Combine(
Name?.ToLower(CultureInfo.InvariantCulture),
Family?.ToLower(CultureInfo.InvariantCulture),
Size?.ToLower(CultureInfo.InvariantCulture),
Tier?.ToString().ToLower(CultureInfo.InvariantCulture),
Capacity);
}
/// <summary>
/// Compares this <see cref="ArmSku"/> instance with another object and determines if they are equals.
/// </summary>
/// <param name="left"> The sku on the left side of the operator. </param>
/// <param name="right"> The sku on the right side of the operator. </param>
/// <returns> True if they are equal, otherwise false. </returns>
public static bool operator ==(ArmSku left, ArmSku right)
{
if (ReferenceEquals(left, null))
{
return ReferenceEquals(right, null);
}
return left.Equals(right);
}
/// <summary>
/// Compares this <see cref="ArmSku"/> instance with another object and determines if they are not equal.
/// </summary>
/// <param name="left"> The sku on the left side of the operator. </param>
/// <param name="right"> The sku on the right side of the operator. </param>
/// <returns> True if they are not equal, otherwise false. </returns>
public static bool operator !=(ArmSku left, ArmSku right)
{
return !(left == right);
}
}
}