컴파일러 오류 CS1110
업데이트: 2007년 11월
오류 메시지
System.Core.dll에 대한 참조가 없는 메서드 선언의 첫 번째 매개 변수에는 'this' 한정자를 사용할 수 없습니다. System.Core.dll에 대한 참조를 추가하거나 메서드 선언에서 'this' 한정자를 제거하십시오.
Cannot use 'this' modifier on first parameter of method declaration without a reference to System.Core.dll. Add a reference to System.Core.dll or remove 'this' modifier from the method declaration.
확장 메서드는 버전 3.5 이상의 .NET Framework에서 지원됩니다. 확장 메서드에서는 특성으로 메서드를 표시하는 메타데이터를 생성합니다. 특성 클래스는 system.core.dll에 있습니다.
이 오류를 해결하려면
- 메시지의 내용과 같이 System.Core.dll에 대한 참조를 추가하거나 메서드 선언에서 this 한정자를 제거합니다.
예제
다음 예제에서는 System.Core.dll에 대한 참조를 사용하여 파일을 컴파일하지 않을 때 CS1110 오류가 발생하는 경우를 보여 줍니다.
// cs1110.cs
// CS1110
// Compile with: /target:library
public static class Extensions
{
public static bool Test(this bool b) { return b; }
}