MethodToken.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // MethodToken.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 Method.
  7. /// </summary>
  8. [Serializable]
  9. public struct MethodToken {
  10. internal int tokValue;
  11. public static readonly MethodToken Empty;
  12. static MethodToken ()
  13. {
  14. Empty = new MethodToken ();
  15. }
  16. internal MethodToken (int val)
  17. {
  18. tokValue = val;
  19. }
  20. /// <summary>
  21. /// </summary>
  22. public override bool Equals (object obj)
  23. {
  24. bool res = obj is MethodToken;
  25. if (res) {
  26. MethodToken that = (MethodToken) obj;
  27. res = (this.tokValue == that.tokValue);
  28. }
  29. return res;
  30. }
  31. /// <summary>
  32. /// Tests whether the given object is an instance of
  33. /// MethodToken and has the same token value.
  34. /// </summary>
  35. public override int GetHashCode ()
  36. {
  37. return tokValue;
  38. }
  39. /// <summary>
  40. /// Returns the metadata token for this Method.
  41. /// </summary>
  42. public int Token {
  43. get {
  44. return tokValue;
  45. }
  46. }
  47. }
  48. }