2010-03-12 Jb Evain <jbevain@novell.com>
[mono.git] / mcs / class / corlib / System.Reflection.Emit / TypeToken.cs
index 9745aa83a7446fbee55ac3cba5f0c0bd1b794af9..a3690df96a3b27bdb38a7518bb63981aa97019b3 100644 (file)
@@ -25,6 +25,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
 
@@ -33,6 +34,7 @@ namespace System.Reflection.Emit {
        ///  Represents the Token returned by the metadata to represent a Type.
        /// </summary>
        [Serializable]
+       [ComVisible (true)]
        public struct TypeToken {
 
                internal int tokValue;
@@ -51,8 +53,6 @@ namespace System.Reflection.Emit {
                        tokValue = val;
                }
 
-
-
                /// <summary>
                /// </summary>
                public override bool Equals (object obj)
@@ -67,6 +67,20 @@ namespace System.Reflection.Emit {
                        return res;
                }
 
+               public bool Equals (TypeToken obj)
+               {
+                       return (this.tokValue == obj.tokValue);
+               }
+
+               public static bool operator == (TypeToken a, TypeToken b)
+               {
+                       return Equals (a, b);
+               }
+
+               public static bool operator != (TypeToken a, TypeToken b)
+               {
+                       return !Equals (a, b);
+               }
 
                /// <summary>
                ///  Tests whether the given object is an instance of