[bcl] Remove the ValueAdd and InetAccess NUnit categories (#2212)
[mono.git] / mcs / class / corlib / System.Security.Permissions / ReflectionPermissionAttribute.cs
index 257894915ac08ebe8c0d1c5f3fe6a39874dc9f91..8680139527940bf7daa4cf0c78c393e2d766946e 100644 (file)
@@ -33,9 +33,7 @@ using System.Runtime.InteropServices;
 
 namespace System.Security.Permissions {
 
-#if NET_2_0
        [ComVisible (true)]
-#endif
        [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
                         AttributeTargets.Struct | AttributeTargets.Constructor |
                         AttributeTargets.Method, AllowMultiple=true, Inherited=false)]
@@ -75,6 +73,7 @@ namespace System.Security.Permissions {
                        }
                }
                
+               [Obsolete]
                public bool ReflectionEmit
                {
                        get { return reflectionEmit; }
@@ -85,11 +84,20 @@ namespace System.Security.Permissions {
                                        flags -= ReflectionPermissionFlag.ReflectionEmit;
                                reflectionEmit = value; 
                        }
-               }  
+               }
+
+               public bool RestrictedMemberAccess
+               {
+                       get { return ((flags & ReflectionPermissionFlag.RestrictedMemberAccess) == ReflectionPermissionFlag.RestrictedMemberAccess); }
+                       set {
+                               if (value)
+                                       flags |= ReflectionPermissionFlag.RestrictedMemberAccess;
+                               else
+                                       flags -= ReflectionPermissionFlag.RestrictedMemberAccess;
+                       }
+               }
 
-#if NET_2_0
                [Obsolete ("not enforced in 2.0+")]
-#endif
                public bool TypeInformation
                {
                        get { return typeInfo; }
@@ -101,16 +109,20 @@ namespace System.Security.Permissions {
                                typeInfo = value; 
                        }
                }
-               
+
                // Methods
                public override IPermission CreatePermission ()
                {
+#if MOBILE
+                       return null;
+#else
                        ReflectionPermission perm = null;
                        if (this.Unrestricted)
                                perm = new ReflectionPermission (PermissionState.Unrestricted);
                        else
                                perm = new ReflectionPermission (flags);
                        return perm;
+#endif
                }
        }
 }