<PackageReference Include="System.Security.Permissions" Version="5.0.0-preview.3.20214.6" />

CodeAccessPermission

Defines the underlying structure of all code access permissions.

Initializes a new instance of the CodeAccessPermission class.

public static void RevertAll()

Causes all previous overrides for the current frame to be removed and no longer in effect.

public static void RevertAssert()

Causes any previous Assert for the current frame to be removed and no longer in effect.

public static void RevertDeny()

Causes any previous Deny for the current frame to be removed and no longer in effect.

public static void RevertPermitOnly()

Causes any previous PermitOnly for the current frame to be removed and no longer in effect.

public void Assert()

Declares that the calling code can access the resource protected by a permission demand through the code that calls this method, even if callers higher in the stack have not been granted permission to access the resource. Using Assert can create security issues.

public abstract IPermission Copy()

When implemented by a derived class, creates and returns an identical copy of the current permission object.

public void Demand()

Forces a SecurityException at run time if all callers higher in the call stack have not been granted the permission specified by the current instance.

public void Deny()

Prevents callers higher in the call stack from using the code that calls this method to access the resource specified by the current instance.

public abstract void FromXml(SecurityElement elem)

When overridden in a derived class, reconstructs a security object with a specified state from an XML encoding.

public abstract IPermission Intersect(IPermission target)

When implemented by a derived class, creates and returns a permission that is the intersection of the current permission and the specified permission.

public abstract bool IsSubsetOf(IPermission target)

When implemented by a derived class, determines whether the current permission is a subset of the specified permission.

public void PermitOnly()

Prevents callers higher in the call stack from using the code that calls this method to access all resources except for the resource specified by the current instance.

public abstract SecurityElement ToXml()

When overridden in a derived class, creates an XML encoding of the security object and its current state.

public virtual IPermission Union(IPermission other)

When overridden in a derived class, creates a permission that is the union of the current permission and the specified permission.