2007-01-25 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / corlib / System.Security / SecurityCriticalAttribute.cs
index 85fb01c76b65c9194a64539a34692bb0ceb397a0..61494169a496ebf29cbbb94b1e7201354b1762ab 100644 (file)
 
 #if NET_2_0
 
-using System.Runtime.InteropServices;
-
 namespace System.Security {
 
-       [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Interface,
+       [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct |
+               AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property |
+               AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate,
                AllowMultiple=false, Inherited=false)]
-       [ComVisible (false)]
+       [MonoTODO ("Not supported by the runtime")]
        public sealed class SecurityCriticalAttribute : Attribute {
 
+               private SecurityCriticalScope _scope;
+
                public SecurityCriticalAttribute ()
                        : base ()
                {
+                       _scope = SecurityCriticalScope.Explicit;
+               }
+
+               public SecurityCriticalAttribute (SecurityCriticalScope scope)
+                       : base ()
+               {
+                       switch (scope) {
+                       case SecurityCriticalScope.Everything:
+                               _scope = SecurityCriticalScope.Everything;
+                               break;
+                       default:
+                               // that includes all bad enums values
+                               _scope = SecurityCriticalScope.Explicit;
+                               break;
+                       }
+               }
+
+               public SecurityCriticalScope Scope {
+                       get { return _scope; }
                }
        }
 }