แก้ไข

แชร์ผ่าน


PermissionState Enum

Definition

Caution

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

Specifies whether a permission should have all or no access to resources at creation.

public enum class PermissionState
[System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public enum PermissionState
public enum PermissionState
[System.Serializable]
public enum PermissionState
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public enum PermissionState
[<System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type PermissionState = 
type PermissionState = 
[<System.Serializable>]
type PermissionState = 
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type PermissionState = 
Public Enum PermissionState
Inheritance
PermissionState
Attributes

Fields

Name Value Description
None 0

No access to the resource protected by the permission.

Unrestricted 1

Full access to the resource protected by the permission.

Remarks

Caution

Code Access Security (CAS) has been deprecated across all versions of .NET Framework and .NET. Recent versions of .NET do not honor CAS annotations and produce errors if CAS-related APIs are used. Developers should seek alternative means of accomplishing security tasks.

Permissions can be created in either a totally restrictive or totally unrestrictive state. A totally restrictive state allows no access to resources; a totally unrestricted state allows all access to a particular resource. For example, the file permission constructor could create an object representing either no access to any files or all access to all files.

Each type of permission clearly defines extreme states representing either all or none of the permissions expressible within the type. Thus, it is possible to create a generic permission in a completely restricted or unrestricted state without knowledge of the particular permission; however, intermediate states can only be set according to the specific permission semantics.

All code access permissions implemented in .NET Framework can take a PermissionState value as an argument to their constructor.

Applies to