<PackageReference Include="System.Security.Permissions" Version="10.0.0-preview.5.25277.114" />

EnvironmentPermission

Controls access to system and user environment variables. This class cannot be inherited.
public EnvironmentPermission(EnvironmentPermissionAccess flag, string pathList)

Initializes a new instance of the EnvironmentPermission class with the specified access to the specified environment variables.

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

public void AddPathList(EnvironmentPermissionAccess flag, string pathList)

Adds access for the specified environment variables to the existing state of the permission.

Gets all environment variables with the specified EnvironmentPermissionAccess.

public bool IsUnrestricted()

Returns a value indicating whether the current permission is unrestricted.

public void SetPathList(EnvironmentPermissionAccess flag, string pathList)

Sets the specified access to the specified environment variables to the existing state of the permission.