Errore del compilatore CS0423

Aggiornamento: novembre 2007

Messaggio di errore

Poiché 'classe' ha l'attributo ComImport, 'metodo' deve essere extern o abstract.
Since 'class' has the ComImport attribute, 'method' must be extern or abstract

Quando è specificato l'attributo ComImport, l'implementazione per la classe viene importata da un modulo COM. Non è possibile definire metodi aggiuntivi.

Il seguente codice di esempio genera l'errore 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();
  }
}