fork download
  1. public class MessageNameAttribute : Attribute
  2. {
  3. private readonly string _Name;
  4. public string Name { get { return _Name; } }
  5. public MessageNameAttribute(string name)
  6. {
  7. _Name = name;
  8. }
  9.  
  10. // Use the hash code of the string objects and xor them together.
  11. // SEHE: WTF I comment is broken
  12. public override int GetHashCode()
  13. {
  14. return _Name.GetHashCode();
  15. }
  16.  
  17. // Determine if the object is a match to this one.
  18. public override bool Match(object obj)
  19. {
  20. if (obj == this) // SEHE: WTF II Calls Equals in absense of operator==? NRE waiting
  21. return true;
  22. if (obj == null) // SEHE: okay...
  23. return false;
  24. if (obj is MessageNameAttribute)
  25. {
  26. // Combine the hash codes and see if they're unchanged.
  27. return (((MessageNameAttribute)obj).GetHashCode() & GetHashCode()) == GetHashCode();
  28. // SEHE: WTF III - wait a minute. So, if our hash code is 0, we'll **always** match?!
  29. // If obj.GetHashCode is 0xFFFFFFFF we'll **always** match?
  30. }
  31. else
  32. {
  33. return false;
  34. }
  35. }
  36. }
  37.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(1,37): error CS0246: The type or namespace name `Attribute' could not be found. Are you missing a using directive or an assembly reference?
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty