Person.cs 827 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. namespace Jint.Tests.Runtime.Domain;
  2. public class Person : IPerson
  3. {
  4. public string Name { get; set; }
  5. public int Age { get; set; }
  6. public Type TypeProperty { get; set; } = typeof(Person);
  7. public override string ToString()
  8. {
  9. return Name;
  10. }
  11. protected bool Equals(Person other)
  12. {
  13. return Name == other.Name;
  14. }
  15. public override bool Equals(object obj)
  16. {
  17. if (ReferenceEquals(null, obj))
  18. {
  19. return false;
  20. }
  21. if (ReferenceEquals(this, obj))
  22. {
  23. return true;
  24. }
  25. if (obj.GetType() != GetType())
  26. {
  27. return false;
  28. }
  29. return Equals((Person) obj);
  30. }
  31. public override int GetHashCode()
  32. {
  33. return (Name != null ? Name.GetHashCode() : 0);
  34. }
  35. }