ClrPropertyDescriptorFactoriesKey.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. namespace Jint.Runtime.Interop
  3. {
  4. internal readonly struct ClrPropertyDescriptorFactoriesKey : IEquatable<ClrPropertyDescriptorFactoriesKey>
  5. {
  6. public ClrPropertyDescriptorFactoriesKey(Type type, Key propertyName)
  7. {
  8. Type = type;
  9. PropertyName = propertyName;
  10. }
  11. private readonly Type Type;
  12. private readonly Key PropertyName;
  13. public bool Equals(ClrPropertyDescriptorFactoriesKey other)
  14. {
  15. return Type == other.Type && PropertyName == other.PropertyName;
  16. }
  17. public override bool Equals(object obj)
  18. {
  19. if (ReferenceEquals(null, obj))
  20. {
  21. return false;
  22. }
  23. return obj is ClrPropertyDescriptorFactoriesKey other && Equals(other);
  24. }
  25. public override int GetHashCode()
  26. {
  27. unchecked
  28. {
  29. return (Type.GetHashCode() * 397) ^ PropertyName.GetHashCode();
  30. }
  31. }
  32. }
  33. }