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

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

Developer Fusion