<PackageReference Include="System.Security.Permissions" Version="9.0.4" />

SecurityPermission

Describes a set of security permissions applied to code. This class cannot be inherited.
public SecurityPermissionFlag Flags { get; set; }

Gets or sets the security permission flags.

Initializes a new instance of the SecurityPermission class with either restricted or unrestricted permission as specified.

Initializes a new instance of the SecurityPermission class with the specified initial set state of the flags.

public bool IsUnrestricted()

Returns a value indicating whether the current permission is unrestricted.