我正在尝试使用DllImport将一个dll文件导入到我的C#项目中,代码如下:
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section, string key,string val,string filePath);
另外,我添加了命名空间System.Runtime.InteropServices:
using System.Runtime.InteropServices;
但是,我遇到了一个错误:
“当前上下文中不存在 'DllImport' 的名称”
在类的哪个位置导入dll有限制吗?