gpt4 book ai didi

c# - SecurityAttribute.Unrestricted 问题

转载 作者:太空宇宙 更新时间:2023-11-03 14:35:44 25 4
gpt4 key购买 nike

我对这个属性感到困惑,如这里所述,http://msdn.microsoft.com/en-us/library/system.security.permissions.securityattribute.unrestricted.aspx我们可以给它完整的或不完整的。

我的困惑是权限,直白的理解,应该只有两种状态——granted和not-granted,full和non-full是什么意思?

最佳答案

我以前以经典方式使用过 Unrestricted 属性:

以下代码是一个请求,声明程序集必须对文件系统具有不受限制的访问权限才能运行。

using System.Security.Permissions;
// Indicates that FileIOPermission is required to run this assembly.
[assembly:FileIOPermission(SecurityAction.RequestMinimum, Unrestricted=true)]
public class FileManager
{
// Insert code to add and delete files.
}

在这种情况下,Unrestricted=false 意味着对于要执行的方法而言,文件访问不是必需的。

与要求执行方法的“对立面”相反,不得授予文件访问权限。

在大多数可能动态创建 SecurityAction (Unrestricted=true||false) 的情况下,第一种情况通常更有意义。

关于c# - SecurityAttribute.Unrestricted 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1160146/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com