SecurityCriticalAttribute.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. namespace System.Security
  5. {
  6. // SecurityCriticalAttribute
  7. // Indicates that the decorated code or assembly performs security critical operations (e.g. Assert, "unsafe", LinkDemand, etc.)
  8. // The attribute can be placed on most targets, except on arguments/return values.
  9. [AttributeUsage(AttributeTargets.Assembly |
  10. AttributeTargets.Class |
  11. AttributeTargets.Struct |
  12. AttributeTargets.Enum |
  13. AttributeTargets.Constructor |
  14. AttributeTargets.Method |
  15. AttributeTargets.Field |
  16. AttributeTargets.Interface |
  17. AttributeTargets.Delegate,
  18. AllowMultiple = false,
  19. Inherited = false)]
  20. public sealed class SecurityCriticalAttribute : Attribute
  21. {
  22. #pragma warning disable 618 // We still use SecurityCriticalScope for v2 compat
  23. public SecurityCriticalAttribute() { }
  24. public SecurityCriticalAttribute(SecurityCriticalScope scope)
  25. {
  26. Scope = scope;
  27. }
  28. [Obsolete("SecurityCriticalScope is only used for .NET 2.0 transparency compatibility.")]
  29. public SecurityCriticalScope Scope { get; }
  30. #pragma warning restore 618
  31. }
  32. }