This documentation is archived and is not being maintained.

Compiler Error CS0423 

Error Message

Since 'class' has the ComImport attribute, 'method' must be extern or abstract

Specifying the ComImport attribute implies that the implementation for the class is to be imported from a COM module. Additional methods may not be defined.

The following sample generates CS0423:

// CS0423.cs

using System.Runtime.InteropServices;

[
  ComImport,
  Guid("7ab770c7-0e23-4d7a-8aa2-19bfad479829")
]
class ImageProperties
{
  public static void Main()  // CS0423
  {
    ImageProperties i = new ImageProperties();
  }
}
Show: