DllImport不会在intellisense中显示

时间:2012-09-14 10:12:34

标签: c# pinvoke dllimport

这是我第一次尝试在C#中使用DllImort。但它没有出现在InteliSense中。我添加了

using System.Runtime.InteropServices;

但它不再起作用了。而是显示 [DllImportAttribute]

我做错了什么?

1 个答案:

答案 0 :(得分:0)

你没有做错任何事。使用此属性可为要导入的方法定义托管签名。

作为例子

[DllImport("kernel32.dll", BestFitMapping = false, 
                CharSet = CharSet.Auto, SetLastError = true)]
private static extern IntPtr GetModuleHandle(string moduleName);

MSDN中查找DllImport

的所有可能参数
相关问题