Advertisement
Guest User

Untitled

a guest
Oct 28th, 2011
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. public bool Equals(Owned other)
  2. {
  3.     return other.Owner == Owner && Type == other.Type;
  4. }
  5.  
  6. public override bool Equals(object obj)
  7. {
  8.     if (obj.GetType() != typeof(Owned)) return false;
  9.     return Equals((Owned)obj);
  10. }
  11.  
  12. public static bool operator ==(Owned x, Owned y)
  13. {
  14.     return x.Equals(y);
  15. }
  16.  
  17. public static bool operator !=(Owned x, Owned y)
  18. {
  19.     return !x.Equals(y);
  20. }
  21.  
  22. public override int GetHashCode()
  23. {
  24.     unchecked
  25.     {
  26.         return (Owner*397) ^ Type.GetHashCode();
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement