-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Netin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Milestone
Description
Edited by @MihaZupan on 2024-02-16
Background and motivation
For a long time, the System.Uri type has provided equality comparison operations via the object.Equals(object?) method and the operator ==() & operator !=() operators. Therefore, there is no reason not to further implement the IEquatable<Uri> interface.
API Proposal
namespace System;
-public partial class Uri : ISpanFormattable, ISerializable
+public partial class Uri : ISpanFormattable, ISerializable, IEquatable<Uri>
{
// Existing
public override bool Equals(object? comparand);
+ public bool Equals(Uri? other);
}API Usage
IEquatable<Uri> a = new Uri("https://example.com/a");
IEquatable<Uri> b = new Uri("https://example.com/b");
Console.WriteLine("Equals? {0}", a.Equals(b));Alternative Designs
No response
Risks
No response
RenderMichael, KieranDevvs, antonfirsov, Neme12 and julealgon
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Netin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged