StringToken.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / clr / src / BCL / System / Reflection / Emit / StringToken.cs / 1 / StringToken.cs

                            // ==++== 
//
//   Copyright (c) Microsoft Corporation.  All rights reserved.
//
// ==--== 
/*============================================================
** 
** Class:  StringToken 
**
** 
** Purpose: Represents a String to the ILGenerator class.
**
**
===========================================================*/ 
namespace System.Reflection.Emit {
 
    using System; 
   using System.Reflection;
    using System.Security.Permissions; 

   [Serializable()]
    [System.Runtime.InteropServices.ComVisible(true)]
    public struct StringToken { 

        internal int m_string; 
 
        //public StringToken() {
        //    m_string=0; 
        //}

        internal StringToken(int str) {
            m_string=str; 
        }
 
        // Returns the metadata token for this particular string. 
        // Generated by a call to Module.GetStringConstant().
        // 
        public int Token {
            get { return m_string; }
        }
 
      public override int GetHashCode()
      { 
         return m_string; 
      }
 
        public override bool Equals(Object obj)
        {
            if (obj is StringToken)
                return Equals((StringToken)obj); 
            else
                return false; 
        } 

        public bool Equals(StringToken obj) 
        {
            return obj.m_string == m_string;
        }
 
        public static bool operator ==(StringToken a, StringToken b)
        { 
            return a.Equals(b); 
        }
 
        public static bool operator !=(StringToken a, StringToken b)
        {
            return !(a == b);
        } 

    } 
 

 



 

} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK