Compiler Error CS0669
A class with the ComImport attribute cannot have a user-defined constructor.
The COM interop layer in the common language runtime supplies the constructor for ComImport classes. Consequently, a COM object can be used as a managed object in the runtime.
The following sample generates 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()
{
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: