aboutsummaryrefslogtreecommitdiff
path: root/Spv.Generator/DeterministicStringKey.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Spv.Generator/DeterministicStringKey.cs')
-rw-r--r--Spv.Generator/DeterministicStringKey.cs30
1 files changed, 30 insertions, 0 deletions
diff --git a/Spv.Generator/DeterministicStringKey.cs b/Spv.Generator/DeterministicStringKey.cs
new file mode 100644
index 00000000..491bb745
--- /dev/null
+++ b/Spv.Generator/DeterministicStringKey.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Diagnostics.CodeAnalysis;
+
+namespace Spv.Generator
+{
+ internal class DeterministicStringKey : IEquatable<DeterministicStringKey>
+ {
+ private string _value;
+
+ public DeterministicStringKey(string value)
+ {
+ _value = value;
+ }
+
+ public override int GetHashCode()
+ {
+ return DeterministicHashCode.GetHashCode(_value);
+ }
+
+ public bool Equals(DeterministicStringKey other)
+ {
+ return _value == other._value;
+ }
+
+ public override bool Equals([NotNullWhen(true)] object obj)
+ {
+ return obj is DeterministicStringKey && Equals((DeterministicStringKey)obj);
+ }
+ }
+}