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

  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. ** Signature:  SignatureToken
  18. **
  19. **
  20. ** Purpose: Represents a Signature to the ILGenerator signature.
  21. **
  22. **
  23. ===========================================================*/
  24. namespace System.Reflection.Emit
  25. {
  26.    
  27.     using System;
  28.     using System.Reflection;
  29.     using System.Security.Permissions;
  30.    
  31.     [System.Runtime.InteropServices.ComVisible(true)]
  32.     public struct SignatureToken
  33.     {
  34.        
  35.         public static readonly SignatureToken Empty = new SignatureToken();
  36.        
  37.         internal int m_signature;
  38.         internal ModuleBuilder m_moduleBuilder;
  39.        
  40.         internal SignatureToken(int str, ModuleBuilder mod)
  41.         {
  42.             m_signature = str;
  43.             m_moduleBuilder = mod;
  44.         }
  45.        
  46.         public int Token {
  47.             get { return m_signature; }
  48.         }
  49.        
  50.         public override int GetHashCode()
  51.         {
  52.             return m_signature;
  53.         }
  54.        
  55.         public override bool Equals(object obj)
  56.         {
  57.             if (obj is SignatureToken)
  58.                 return Equals((SignatureToken)obj);
  59.             else
  60.                 return false;
  61.         }
  62.        
  63.         public bool Equals(SignatureToken obj)
  64.         {
  65.             return obj.m_signature == m_signature;
  66.         }
  67.        
  68.         public static bool operator ==(SignatureToken a, SignatureToken b)
  69.         {
  70.             return a.Equals(b);
  71.         }
  72.        
  73.         public static bool operator !=(SignatureToken a, SignatureToken b)
  74.         {
  75.             return !(a == b);
  76.         }
  77.        
  78.     }
  79. }

Developer Fusion