CodeAccessSecurityAttribute Класс

Определение

Внимание

Code Access Security is not supported or honored by the runtime.

Задает базовый класс атрибутов для обеспечения безопасности доступа к коду.

public ref class CodeAccessSecurityAttribute abstract : System::Security::Permissions::SecurityAttribute
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
[System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public abstract class CodeAccessSecurityAttribute : System.Security.Permissions.SecurityAttribute
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
public abstract class CodeAccessSecurityAttribute : System.Security.Permissions.SecurityAttribute
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
[System.Serializable]
public abstract class CodeAccessSecurityAttribute : System.Security.Permissions.SecurityAttribute
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class CodeAccessSecurityAttribute : System.Security.Permissions.SecurityAttribute
[<System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)>]
[<System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type CodeAccessSecurityAttribute = class
    inherit SecurityAttribute
[<System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)>]
type CodeAccessSecurityAttribute = class
    inherit SecurityAttribute
[<System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)>]
[<System.Serializable>]
type CodeAccessSecurityAttribute = class
    inherit SecurityAttribute
[<System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type CodeAccessSecurityAttribute = class
    inherit SecurityAttribute
Public MustInherit Class CodeAccessSecurityAttribute
Inherits SecurityAttribute
Наследование
CodeAccessSecurityAttribute
Производный
Атрибуты

Комментарии

Предостережение

Безопасность доступа к коду (CAS) устарела во всех версиях платформ .NET Framework, и .NET. Последние версии .NET не учитывают заметки CAS и создают ошибки, если используются API, связанные с CAS. Разработчики должны искать альтернативные средства выполнения задач безопасности.

Этот класс атрибута SecurityActionсвязывает , например, Demandс настраиваемым атрибутом безопасности.

Типы, производные от CodeAccessSecurityAttribute них, используются для ограничения доступа к ресурсам или защищаемым операциям.

Сведения о безопасности, объявленные атрибутом безопасности, хранятся в метаданных целевого атрибута и получают доступ к системе во время выполнения. Атрибуты безопасности используются только для декларативной безопасности. Используйте соответствующий класс разрешений, производный от CodeAccessPermission императивной безопасности.

Примечания для тех, кто реализует этот метод

Все атрибуты разрешений, производные от этого класса, должны иметь только один конструктор, который принимает SecurityAction его единственный параметр.

Конструкторы

Имя Описание
CodeAccessSecurityAttribute(SecurityAction)
Устаревшие..

Инициализирует новый экземпляр CodeAccessSecurityAttribute с указанным SecurityAction.

Свойства

Имя Описание
Action
Устаревшие..

Возвращает или задает действие по обеспечению безопасности.

(Унаследовано от SecurityAttribute)
TypeId
Устаревшие..

При реализации в производном классе получает уникальный идентификатор для этого Attribute.

(Унаследовано от Attribute)
Unrestricted
Устаревшие..

Возвращает или задает значение, указывающее, объявлено ли полное (неограниченное) разрешение на ресурс, защищенный атрибутом.

(Унаследовано от SecurityAttribute)

Методы

Имя Описание
CreatePermission()
Устаревшие..

При переопределении в производном классе создает объект разрешения, который затем можно сериализовать в двоичную форму и постоянно хранить вместе с SecurityAction метаданными сборки.

(Унаследовано от SecurityAttribute)
Equals(Object)
Устаревшие..

Возвращает значение, указывающее, равен ли этот экземпляр указанному объекту.

(Унаследовано от Attribute)
GetHashCode()
Устаревшие..

Возвращает хэш-код для этого экземпляра.

(Унаследовано от Attribute)
GetType()
Устаревшие..

Возвращает Type текущего экземпляра.

(Унаследовано от Object)
IsDefaultAttribute()
Устаревшие..

При переопределении в производном классе указывает, является ли значение этого экземпляра значением по умолчанию для производного класса.

(Унаследовано от Attribute)
Match(Object)
Устаревшие..

При переопределении в производном классе возвращает значение, указывающее, равен ли этот экземпляр указанному объекту.

(Унаследовано от Attribute)
MemberwiseClone()
Устаревшие..

Создает неглубокую копию текущей Object.

(Унаследовано от Object)
ToString()
Устаревшие..

Возвращает строку, представляющую текущий объект.

(Унаследовано от Object)

Явные реализации интерфейса

Имя Описание
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)
Устаревшие..

Сопоставляет набор имен соответствующему набору идентификаторов диспетчеризации.

(Унаследовано от Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)
Устаревшие..

Извлекает сведения о типе объекта, который можно использовать для получения сведений о типе для интерфейса.

(Унаследовано от Attribute)
_Attribute.GetTypeInfoCount(UInt32)
Устаревшие..

Возвращает количество предоставляемых объектом интерфейсов для доступа к сведениям о типе (0 или 1).

(Унаследовано от Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)
Устаревшие..

Предоставляет доступ к свойствам и методам, предоставляемым объектом.

(Унаследовано от Attribute)

Применяется к

См. также раздел