更新:2007 年 11 月
错误消息
必须在标记为“static”和“extern”的方法上指定 DllImport 属性
DllImport 属性用在了不具有正确访问关键字的方法中。
下面的示例生成 CS0601:
// CS0601.cs
using System.Runtime.InteropServices;
using System.Text;
public class C
{
   [DllImport("KERNEL32.DLL")]
   extern int GetCurDirectory(int bufSize, StringBuilder buf);   // CS0601
   // Try the following line instead:
   // static extern int GetCurDirectory(int bufSize, StringBuilder buf);
}
public class MainClass
{
   public static void Main ()
   {
   }
}