diff --git a/Core/Extensions/AsChars.cs b/Core/Extensions/AsChars.cs
index d00b6c96..f31ef20b 100644
--- a/Core/Extensions/AsChars.cs
+++ b/Core/Extensions/AsChars.cs
@@ -35,4 +35,4 @@ public static Char[] AsChars(this Rune rune) {
/// There was an issue with the internal buffers.
public static Char[] AsChars(this Int32 codepoint) => new Rune(codepoint).AsChars();
}
-}
\ No newline at end of file
+}
diff --git a/Core/Extensions/ParseInt32.cs b/Core/Extensions/ParseInt32.cs
index 2375d296..925a91b8 100644
--- a/Core/Extensions/ParseInt32.cs
+++ b/Core/Extensions/ParseInt32.cs
@@ -110,4 +110,4 @@ public static Int32 ParseInt32(this String @string, IFormatProvider provider) {
return Int32.Parse(@string, provider);
}
}
-}
\ No newline at end of file
+}
diff --git a/Core/Extensions/ToLower.cs b/Core/Extensions/ToLower.cs
index 9b1cf45a..c2920def 100644
--- a/Core/Extensions/ToLower.cs
+++ b/Core/Extensions/ToLower.cs
@@ -55,4 +55,4 @@ public static Rune ToLower(this Rune rune, CultureInfo culture) {
/// The lowercase equivalent of the parameter, or the unchanged value of , if is already lowercase or not alphabetic.
public static Rune ToLowerInvariant(this Rune rune) => Rune.ToLowerInvariant(rune);
}
-}
\ No newline at end of file
+}
diff --git a/Core/SurrogatePair.cs b/Core/SurrogatePair.cs
index bb02ff8e..5871bf3b 100644
--- a/Core/SurrogatePair.cs
+++ b/Core/SurrogatePair.cs
@@ -6,7 +6,7 @@ namespace Stringier {
/// Represents a UTF-16 Surrogate Pair.
///
[StructLayout(LayoutKind.Auto)]
- public readonly struct SurrogatePair {
+ public readonly struct SurrogatePair : IEquatable {
///
/// The high surrogate
///
@@ -54,5 +54,41 @@ public SurrogatePair(CodePoint codePoint) {
/// Gets the this represents.
///
public CodePoint CodePoint => new CodePoint(Unsafe.Utf16Decode(High.value, Low.value));
+
+ ///
+ /// Returns a value that indicates whether this instance is equal to a specified object.
+ ///
+ /// The object to compare to.
+ /// if equal to the value of this instance; otherwise, .
+ public override Boolean Equals(Object obj) {
+ switch (obj) {
+ case SurrogatePair other:
+ return Equals(other);
+ default:
+ return false;
+ }
+ }
+
+ ///
+ /// Returns a value that indicates whether this instance is equal to a specified object.
+ ///
+ /// The object to compare to.
+ /// if equal to the value of this instance; otherwise, .
+ public Boolean Equals(SurrogatePair other) => High.Equals(other.High) && Low.Equals(other.Low);
+
+ ///
+ /// Returns the hash code for this instance.
+ ///
+ /// A 32-bit signed integer hash code.
+ ///
+ /// The hash code of a is always the integer value of the code point.
+ ///
+ public override Int32 GetHashCode() => High.GetHashCode() ^ Low.GetHashCode();
+
+ ///
+ /// Converts the value of this instance to its equivalent string representation.
+ ///
+ /// The string representation of the value of this instance.
+ public override String ToString() => $"({High}, {Low})";
}
}