EventToken.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // EventToken.cs
  2. //
  3. // (C) 2001 Ximian, Inc. http://www.ximian.com
  4. namespace System.Reflection.Emit {
  5. /// <summary>
  6. /// Represents the Token returned by the metadata to represent a Event.
  7. /// </summary>
  8. public struct EventToken {
  9. internal int tokValue;
  10. public static readonly EventToken Empty;
  11. static EventToken ()
  12. {
  13. Empty = new EventToken ();
  14. }
  15. internal EventToken (int val)
  16. {
  17. tokValue = val;
  18. }
  19. /// <summary>
  20. /// </summary>
  21. public override bool Equals (object obj)
  22. {
  23. bool res = obj is EventToken;
  24. if (res) {
  25. EventToken that = (EventToken) obj;
  26. res = (this.tokValue == that.tokValue);
  27. }
  28. return res;
  29. }
  30. /// <summary>
  31. /// Tests whether the given object is an instance of
  32. /// EventToken and has the same token value.
  33. /// </summary>
  34. public override int GetHashCode ()
  35. {
  36. return tokValue;
  37. }
  38. /// <summary>
  39. /// Returns the metadata token for this Event.
  40. /// </summary>
  41. public int Token {
  42. get {
  43. return tokValue;
  44. }
  45. }
  46. }
  47. }