Skip to main content
 首页 » 编程设计

c#之SuppressUnmanagedCodeSecurity 还是 SuppressUnmanagedCodeSecurityAttribute

2024年02月13日22mate10pro

要禁用安全检查,我应该设置什么? SuppressUnmanagedCodeSecurityAttribute 还是 SuppressUnmanagedCodeSecurity?

以下哪个版本是正确的?

    [DllImport("Native.dll"), SuppressUnmanagedCodeSecurity] 
    public static extern void Method(... 

或

    [DllImport("Native.dll"), SuppressUnmanagedCodeSecurityAttribute] 
    public static extern void Method(... 

请您参考如下方法:

两者做同样的事情。该类名为SuppressUnmanagedCodeSecurityAttribute,但在一般注释属性时,可以省略后缀Attribute。