更新:2007 年 11 月
错误消息
具有 ComImport 属性的类不能有用户定义的构造函数
公共语言运行库中的 COM 互操作层为 ComImport 类提供构造函数。因此,COM 对象可以在运行库中作为托管对象使用。
下面的示例生成 CS0669:
// CS0669.cs
using System.Runtime.InteropServices;
[ComImport, Guid("00000000-0000-0000-0000-000000000001")]
class TestClass
{
   TestClass()   // CS0669, delete constructor to resolve
   {
   }
   public static void Main()
   {
   }
}