11namespace AspNetCoreAnalyzers ;
22
3- using System ;
43using System . Collections . Immutable ;
54using System . Diagnostics ;
65using Microsoft . CodeAnalysis ;
1110/// https://tools.ietf.org/html/rfc1738.
1211/// </summary>
1312[ DebuggerDisplay ( "{this.Literal.LiteralExpression.ToString()}" ) ]
14- internal struct UrlTemplate : IEquatable < UrlTemplate >
13+ internal readonly record struct UrlTemplate
1514{
1615 private UrlTemplate ( StringLiteral literal , ImmutableArray < PathSegment > path )
1716 {
@@ -23,31 +22,9 @@ private UrlTemplate(StringLiteral literal, ImmutableArray<PathSegment> path)
2322
2423 internal ImmutableArray < PathSegment > Path { get ; }
2524
26- public static bool operator == ( UrlTemplate left , UrlTemplate right )
27- {
28- return left . Equals ( right ) ;
29- }
25+ public bool Equals ( UrlTemplate other ) => this . Literal . Equals ( other . Literal ) ;
3026
31- public static bool operator != ( UrlTemplate left , UrlTemplate right )
32- {
33- return ! left . Equals ( right ) ;
34- }
35-
36- public bool Equals ( UrlTemplate other )
37- {
38- return this . Literal . Equals ( other . Literal ) ;
39- }
40-
41- public override bool Equals ( object ? obj )
42- {
43- return obj is UrlTemplate other &&
44- this . Equals ( other ) ;
45- }
46-
47- public override int GetHashCode ( )
48- {
49- return this . Literal . GetHashCode ( ) ;
50- }
27+ public override int GetHashCode ( ) => this . Literal . GetHashCode ( ) ;
5128
5229 internal static bool TryParse ( LiteralExpressionSyntax literal , out UrlTemplate template )
5330 {
0 commit comments