File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed
src/Microsoft.OpenApi/Expressions
test/Microsoft.OpenApi.Tests/PublicApi Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -78,23 +78,29 @@ public static RuntimeExpression Build(string expression)
78
78
/// </summary>
79
79
public override int GetHashCode ( )
80
80
{
81
- return Expression . GetHashCode ( ) ;
81
+ return StringComparer . Ordinal . GetHashCode ( Expression ) ;
82
82
}
83
83
84
84
/// <summary>
85
85
/// Equals implementation for IEquatable.
86
86
/// </summary>
87
87
public override bool Equals ( object ? obj )
88
88
{
89
- return Equals ( obj as RuntimeExpression ) ;
89
+ if ( obj == null )
90
+ {
91
+ return false ;
92
+ }
93
+ if ( ReferenceEquals ( this , obj ) )
94
+ {
95
+ return true ;
96
+ }
97
+ return obj is RuntimeExpression runtimeExpression && Equals ( runtimeExpression ) ;
90
98
}
91
99
92
- /// <summary>
93
- /// Equals implementation for object of the same type.
94
- /// </summary>
95
- public bool Equals ( RuntimeExpression ? obj )
100
+ /// <inheritdoc />
101
+ public bool Equals ( RuntimeExpression ? other )
96
102
{
97
- return obj != null && obj . Expression == Expression ;
103
+ return other is not null && StringComparer . Ordinal . Equals ( Expression , other . Expression ) ;
98
104
}
99
105
100
106
/// <inheritdoc />
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ namespace Microsoft.OpenApi.Expressions
115
115
public const string Prefix = "$";
116
116
protected RuntimeExpression() { }
117
117
public abstract string Expression { get; }
118
- public bool Equals(Microsoft.OpenApi.Expressions.RuntimeExpression? obj ) { }
118
+ public bool Equals(Microsoft.OpenApi.Expressions.RuntimeExpression? other ) { }
119
119
public override bool Equals(object? obj) { }
120
120
public override int GetHashCode() { }
121
121
public override string ToString() { }
You can’t perform that action at this time.
0 commit comments