DeterministicStringKey.cs 660 B

1234567891011121314151617181920212223242526272829
  1. using System;
  2. namespace Spv.Generator
  3. {
  4. internal class DeterministicStringKey : IEquatable<DeterministicStringKey>
  5. {
  6. private readonly string _value;
  7. public DeterministicStringKey(string value)
  8. {
  9. _value = value;
  10. }
  11. public override int GetHashCode()
  12. {
  13. return DeterministicHashCode.GetHashCode(_value);
  14. }
  15. public bool Equals(DeterministicStringKey other)
  16. {
  17. return _value == other?._value;
  18. }
  19. public override bool Equals(object obj)
  20. {
  21. return obj is DeterministicStringKey key && Equals(key);
  22. }
  23. }
  24. }