The Labs \ Source Viewer \ SSCLI \ System.Diagnostics.SymbolStore \ SymbolToken

  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:  SymbolToken
  18. **
  19. ** Small value class used by the SymbolStore package for passing
  20. ** around metadata tokens.
  21. **
  22. ===========================================================*/
  23. namespace System.Diagnostics.SymbolStore
  24. {
  25.    
  26.     using System;
  27.     using System.Runtime.InteropServices;
  28.    
  29.     [ComVisible(true)]
  30.     public struct SymbolToken
  31.     {
  32.         internal int m_token;
  33.        
  34.         public SymbolToken(int val)
  35.         {
  36.             m_token = val;
  37.         }
  38.        
  39.         public int GetToken()
  40.         {
  41.             return m_token;
  42.         }
  43.        
  44.         public override int GetHashCode()
  45.         {
  46.             return m_token;
  47.         }
  48.        
  49.         public override bool Equals(object obj)
  50.         {
  51.             if (obj is SymbolToken)
  52.                 return Equals((SymbolToken)obj);
  53.             else
  54.                 return false;
  55.         }
  56.        
  57.         public bool Equals(SymbolToken obj)
  58.         {
  59.             return obj.m_token == m_token;
  60.         }
  61.        
  62.         public static bool operator ==(SymbolToken a, SymbolToken b)
  63.         {
  64.             return a.Equals(b);
  65.         }
  66.        
  67.         public static bool operator !=(SymbolToken a, SymbolToken b)
  68.         {
  69.             return !(a == b);
  70.         }
  71.     }
  72. }

Developer Fusion