Compiler Warning (level 1) CS0626

Method, operator, or accessor 'method' is marked external and has no attributes on it. Consider adding a DllImport attribute to specify the external implementation.

A method marked extern should also be marked with an attribute, for example, the DllImport attribute.

The attribute specifies where the method is implemented. At run time, the program will need this information.

The following sample generates CS0626:

// CS0626.cs  
// compile with: /warnaserror  
using System.Runtime.InteropServices;  
public class MyClass  
   static extern public void M(); // CS0626  
   // try the following line  
   // [DllImport("mydll.dll")] static extern public void M();  
   public static void Main()