StringToken.cs 982 B

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