Share via


컴파일러 경고(수준 1) CS0626

업데이트: 2007년 11월

오류 메시지

'method' 메서드, 연산자 또는 접근자가 외부로 표시되었지만 특성이 없습니다. DllImport 특성을 추가하여 외부 구현을 지정하십시오.
Method, operator, or accessor 'method' is marked external and has no attributes on it. Consider adding a DllImport attribute to specify the external implementation

extern으로 표시한 메서드는 예를 들어, DllImport와 같은 특성으로 표시해야 합니다.

특성에서 메서드가 구현된 위치를 지정하면 런타임에 프로그램에서 이 정보를 사용합니다.

다음 샘플에서는 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()
   {
   }
}