The Labs \ Source Viewer \ SSCLI \ System.Reflection.Emit \ ParameterToken

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. /*============================================================
  16. **
  17. ** Class:  ParameterToken
  18. **
  19. **
  20. ** Purpose: metadata tokens for a parameter
  21. **
  22. **
  23. ===========================================================*/
  24. namespace System.Reflection.Emit
  25. {
  26.    
  27.     using System;
  28.     using System.Reflection;
  29.     using System.Security.Permissions;
  30.    
  31.     // The ParameterToken class is an opaque representation of the Token returned
  32.     // by the Metadata to represent the parameter.
  33.     [Serializable()]
  34.     [System.Runtime.InteropServices.ComVisible(true)]
  35.     public struct ParameterToken
  36.     {
  37.        
  38.         public static readonly ParameterToken Empty = new ParameterToken();
  39.         internal int m_tkParameter;
  40.        
  41.        
  42.         internal ParameterToken(int tkParam)
  43.         {
  44.             m_tkParameter = tkParam;
  45.         }
  46.        
  47.         public int Token {
  48.             get { return m_tkParameter; }
  49.         }
  50.        
  51.         public override int GetHashCode()
  52.         {
  53.             return m_tkParameter;
  54.         }
  55.        
  56.         public override bool Equals(object obj)
  57.         {
  58.             if (obj is ParameterToken)
  59.                 return Equals((ParameterToken)obj);
  60.             else
  61.                 return false;
  62.         }
  63.        
  64.         public bool Equals(ParameterToken obj)
  65.         {
  66.             return obj.m_tkParameter == m_tkParameter;
  67.         }
  68.        
  69.         public static bool operator ==(ParameterToken a, ParameterToken b)
  70.         {
  71.             return a.Equals(b);
  72.         }
  73.        
  74.         public static bool operator !=(ParameterToken a, ParameterToken b)
  75.         {
  76.             return !(a == b);
  77.         }
  78.        
  79.     }
  80. }

Developer Fusion