New tests.
[mono.git] / mcs / class / corlib / System / Type.cs
index 4adbc420f71a1ddd3f6904ae8ddf2199cb5c5e1b..a6d6f0d52f16dee34450ef32c1939198ccc7d6b1 100644 (file)
@@ -435,13 +435,27 @@ namespace System {
 #if NET_4_0
                public virtual bool Equals (Type o)
                {
+                       if ((object)o == this)
+                               return true;
+                       if ((object)o == null)
+                               return false;
+                       Type me = UnderlyingSystemType;
+                       if ((object)me == null)
+                               return false;
+
+                       o = o.UnderlyingSystemType;
+                       if ((object)o == null)
+                               return false;
+                       if ((object)o == this)
+                               return true;
+                       return me.EqualsInternal (o);
+               }               
 #else
                public bool Equals (Type o)
                {
 
                        if (o == this)
                                return true;
-#endif
                        if (o == null)
                                return false;
                        Type me = UnderlyingSystemType;
@@ -449,7 +463,7 @@ namespace System {
                                return false;
                        return me.EqualsInternal (o.UnderlyingSystemType);
                }
-
+#endif
 #if NET_4_0
                [MonoTODO ("Implement it properly once 4.0 impl details are known.")]
                public static bool operator == (Type left, Type right)
@@ -577,23 +591,37 @@ namespace System {
                        }
                        return false;
                }
+       
+               public static Type GetType (string typeName, Func<AssemblyName,Assembly> assemblyResolver, Func<Assembly,string,bool,Type> typeResolver)
+               {
+                       return GetType (typeName, assemblyResolver, typeResolver, false, false);
+               }
+       
+               public static Type GetType (string typeName, Func<AssemblyName,Assembly> assemblyResolver, Func<Assembly,string,bool,Type> typeResolver, bool throwOnError)
+               {
+                       return GetType (typeName, assemblyResolver, typeResolver, throwOnError, false);
+               }
+       
+               public static Type GetType (string typeName, Func<AssemblyName,Assembly> assemblyResolver, Func<Assembly,string,bool,Type> typeResolver, bool throwOnError, bool ignoreCase)
+               {
+                       TypeSpec spec = TypeSpec.Parse (typeName);
+                       return spec.Resolve (assemblyResolver, typeResolver, throwOnError, ignoreCase);
+               }
 
+               public virtual bool IsSecurityTransparent
+               {
+                       get { throw CreateNIE (); }
+               }
 
-       public static Type GetType (string typeName, Func<AssemblyName,Assembly> assemblyResolver, Func<Assembly,string,bool,Type> typeResolver)
-       {
-               return GetType (typeName, assemblyResolver, typeResolver, false, false);
-       }
-
-       public static Type GetType (string typeName, Func<AssemblyName,Assembly> assemblyResolver, Func<Assembly,string,bool,Type> typeResolver, bool throwOnError)
-       {
-               return GetType (typeName, assemblyResolver, typeResolver, throwOnError, false);
-       }
+               public virtual bool IsSecurityCritical
+               {
+                       get { throw CreateNIE (); }
+               }
 
-       public static Type GetType (string typeName, Func<AssemblyName,Assembly> assemblyResolver, Func<Assembly,string,bool,Type> typeResolver, bool throwOnError, bool ignoreCase)
-       {
-               TypeSpec spec = TypeSpec.Parse (typeName);
-               return spec.Resolve (assemblyResolver, typeResolver, throwOnError, ignoreCase);
-       }
+               public virtual bool IsSecuritySafeCritical
+               {
+                       get { throw CreateNIE (); }
+               }
 #endif
                
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -1210,23 +1238,18 @@ namespace System {
                                }
                        }
                        if ((memberType & MemberTypes.Property) != 0) {
-                               PropertyInfo[] c;
-                               int count = l.Count;
-                               Type ptype;
+                               PropertyInfo[] c = GetProperties (bindingAttr);
+
+
                                if (filter != null) {
-                                       ptype = this;
-                                       while ((l.Count == count) && (ptype != null)) {
-                                               c = ptype.GetProperties (bindingAttr);
-                                               foreach (MemberInfo m in c) {
-                                                       if (filter (m, filterCriteria))
-                                                               l.Add (m);
-                                               }
-                                               ptype = ptype.BaseType;
+                                       foreach (MemberInfo m in c) {
+                                               if (filter (m, filterCriteria))
+                                                       l.Add (m);
                                        }
                                } else {
-                                       c = GetProperties (bindingAttr);
                                        l.AddRange (c);
                                }
+
                        }
                        if ((memberType & MemberTypes.Event) != 0) {
                                EventInfo[] c = GetEvents (bindingAttr);
@@ -1323,6 +1346,11 @@ namespace System {
                        }
                }
 
+               internal virtual Type InternalResolve ()
+               {
+                       return UnderlyingSystemType;
+               }
+
                internal bool IsSystemType {
                        get {
                                return _impl.Value != IntPtr.Zero;