Add few 4.5 types to compile MEF2
[mono.git] / mcs / class / corlib / System.Reflection / MonoModule.cs
index 16b82da0fce293e6a262612f69bc8ebceb83f373..97e3481c9c7e535a3dfb66106cad4c8596f93d36 100644 (file)
@@ -38,7 +38,7 @@ using System.Security.Permissions;
 
 namespace System.Reflection {
 
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
        [ComVisible (true)]
        [ComDefaultInterfaceAttribute (typeof (_Module))]
        [Serializable]
@@ -49,7 +49,7 @@ namespace System.Reflection {
 #endif
 
                public
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                override
 #endif
                Assembly Assembly {
@@ -57,7 +57,7 @@ namespace System.Reflection {
                }
 
                public
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                override
 #endif
                // Note: we do not ask for PathDiscovery because no path is returned here.
@@ -67,7 +67,7 @@ namespace System.Reflection {
                }
        
                public
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                override
 #endif
                string ScopeName {
@@ -75,7 +75,7 @@ namespace System.Reflection {
                }
 
                public
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                override
 #endif
                int MDStreamVersion {
@@ -87,7 +87,7 @@ namespace System.Reflection {
                }
 
                public
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                override
 #endif
                Guid ModuleVersionId {
@@ -96,7 +96,7 @@ namespace System.Reflection {
                        }
                }
 
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                public override
 #else
                public virtual
@@ -113,7 +113,7 @@ namespace System.Reflection {
                }
 
                public
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                override
 #endif
                bool IsResource()
@@ -121,22 +121,22 @@ namespace System.Reflection {
                        return is_resource;
                }
 
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                public override
 #else
                public virtual
 #endif
                Type[] FindTypes(TypeFilter filter, object filterCriteria) 
                {
-                       System.Collections.ArrayList filtered = new System.Collections.ArrayList ();
+                       var filtered = new List<Type> ();
                        Type[] types = GetTypes ();
                        foreach (Type t in types)
                                if (filter (t, filterCriteria))
                                        filtered.Add (t);
-                       return (Type[])filtered.ToArray (typeof(Type));
+                       return filtered.ToArray ();
                }
 
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                public override
 #else
                public virtual
@@ -146,7 +146,7 @@ namespace System.Reflection {
                        return MonoCustomAttrs.GetCustomAttributes (this, inherit);
                }
 
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                public override
 #else
                public virtual
@@ -156,7 +156,7 @@ namespace System.Reflection {
                        return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
                }
 
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                public override
 #else
                public virtual
@@ -170,7 +170,7 @@ namespace System.Reflection {
                        return (globalType != null) ? globalType.GetField (name, bindingAttr) : null;
                }
 
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                public override
 #else
                public virtual
@@ -184,7 +184,7 @@ namespace System.Reflection {
                        return (globalType != null) ? globalType.GetFields (bindingFlags) : new FieldInfo [0];
                }
 
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                public override
 #else
                public virtual
@@ -193,7 +193,7 @@ namespace System.Reflection {
                        get { return get_MetadataToken (this); }
                }
                protected
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                override
 #else
                virtual
@@ -204,11 +204,15 @@ namespace System.Reflection {
                                return null;
 
                        Type globalType = GetGlobalType ();
-                       return (globalType != null) ? globalType.GetMethod (name, bindingAttr, binder, callConvention, types, modifiers) : null;
+                       if (globalType == null)
+                               return null;
+                       if (types == null)
+                               return globalType.GetMethod (name);
+                       return globalType.GetMethod (name, bindingAttr, binder, callConvention, types, modifiers);
                }
 
                public
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                override
 #endif
                MethodInfo[] GetMethods (BindingFlags bindingFlags) {
@@ -219,7 +223,7 @@ namespace System.Reflection {
                        return (globalType != null) ? globalType.GetMethods (bindingFlags) : new MethodInfo [0];
                }
 
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                public override
 #else
                public virtual
@@ -228,7 +232,7 @@ namespace System.Reflection {
                        ModuleHandle.GetPEKind (out peKind, out machine);
                }
 
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                public override
 #else
                public virtual
@@ -242,7 +246,7 @@ namespace System.Reflection {
                        return assembly.InternalGetType (this, className, throwOnError, ignoreCase);
                }
        
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                public override
 #else
                public virtual
@@ -253,7 +257,7 @@ namespace System.Reflection {
                }
 
                public
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                override
 #endif
                FieldInfo ResolveField (int metadataToken, Type [] genericTypeArguments, Type [] genericMethodArguments) {
@@ -267,7 +271,7 @@ namespace System.Reflection {
                }
 
                public
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                override
 #endif
                MemberInfo ResolveMember (int metadataToken, Type [] genericTypeArguments, Type [] genericMethodArguments) {
@@ -282,7 +286,7 @@ namespace System.Reflection {
                }
 
                public
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                override
 #endif
                MethodBase ResolveMethod (int metadataToken, Type [] genericTypeArguments, Type [] genericMethodArguments) {
@@ -296,7 +300,7 @@ namespace System.Reflection {
                }
 
                public
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                override
 #endif
                string ResolveString (int metadataToken) {
@@ -310,7 +314,7 @@ namespace System.Reflection {
                }
 
                public
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                override
 #endif
                Type ResolveType (int metadataToken, Type [] genericTypeArguments, Type [] genericMethodArguments) {
@@ -324,7 +328,7 @@ namespace System.Reflection {
                }
 
                public
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                override
 #endif
                byte[] ResolveSignature (int metadataToken) {
@@ -354,7 +358,7 @@ namespace System.Reflection {
                }
 #endif
 
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                public override
 #else
                public virtual
@@ -364,7 +368,7 @@ namespace System.Reflection {
                        return InternalGetTypes ();
                }
 
-#if NET_4_0
+#if NET_4_0 || MOONLIGHT || MOBILE
                public override IList<CustomAttributeData> GetCustomAttributesData () {
                        return CustomAttributeData.GetCustomAttributes (this);
                }