SecurityPermissionAttribute.UnmanagedCode 属性
获取或设置一个值,该值指示是否声明了调用非托管代码的权限。
**命名空间:**System.Security.Permissions
**程序集:**mscorlib(在 mscorlib.dll 中)
语法
声明
Public Property UnmanagedCode As Boolean
用法
Dim instance As SecurityPermissionAttribute
Dim value As Boolean
value = instance.UnmanagedCode
instance.UnmanagedCode = value
public bool UnmanagedCode { get; set; }
public:
property bool UnmanagedCode {
bool get ();
void set (bool value);
}
/** @property */
public boolean get_UnmanagedCode ()
/** @property */
public void set_UnmanagedCode (boolean value)
public function get UnmanagedCode () : boolean
public function set UnmanagedCode (value : boolean)
属性值
如果声明了调用非托管代码的权限,则为 true;否则为 false。
示例
下面的代码示例演示如何使用 UnmanagedCode 属性拒绝调用非托管代码的能力。有关完整的代码示例,请参见 SecurityPermissionAttribute 类。
' Set the Assertion,UnmanagedCode, ControlAppDomain, ControlDomainPolicy, ontrolEvidence,
' ControlPolicy, ControlPrincipal, ControlThread, Execution, Flags, Infrastructure,
' RemotingConfiguration, SerializationFormatter, and SkipVerification properties.
<SecurityPermissionAttribute(SecurityAction.Deny, Assertion:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, ControlAppDomain:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, ControlDomainPolicy:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, ControlEvidence:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, ControlPolicy:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, ControlPrincipal:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, ControlThread:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, Execution:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, Flags:=SecurityPermissionFlag.NoFlags), _
SecurityPermissionAttribute(SecurityAction.Deny, Infrastructure:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, RemotingConfiguration:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, SerializationFormatter:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, SkipVerification:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, UnmanagedCode:=True)> _
Public Shared Sub DenySecurityPermissions()
// Set the UnmanagedCode property.
[SecurityPermissionAttribute(SecurityAction.Deny, UnmanagedCode = true)]
// Set the UnmanagedCode property.
[SecurityPermissionAttribute(SecurityAction::Deny,UnmanagedCode=true)]
// Set the UnmanagedCode property.
/** @attribute SecurityPermissionAttribute(SecurityAction.Deny,
UnmanagedCode = true)
*/
平台
Windows 98、Windows 2000 SP4、Windows Millennium Edition、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0、1.1、1.0
请参见
参考
SecurityPermissionAttribute 类
SecurityPermissionAttribute 成员
System.Security.Permissions 命名空间