컴파일러 오류 CS0755
업데이트: 2007년 11월
오류 메시지
두 부분 메서드(Partial Method) 선언 모두 확장 메서드이거나 확장 메서드가 아니어야 합니다.
Both partial method declarations must be extension methods or neither may be an extension method.
부분 메서드는 정의 선언(시그니처) 및 선택적 요소인 구현 선언(본문)으로 구성됩니다. 정의 선언이 확장 메서드인 경우 정의된 구현 선언도 확장 메서드여야 합니다. 정의 메서드가 확장 메서드가 아닌 경우에는 구현 메서드도 확장 메서드가 아니어야 합니다.
이 오류를 해결하려면
- 한 부분에서 this 한정자를 제거하거나 다른 한 부분에 해당 한정자를 추가합니다.
예제
다음 예제에서는 CS0755 오류가 발생하는 경우를 보여 줍니다.
// cs0755.cs
public static partial class Ext
{
static partial void Part(this C c); //Extension method
// Typically the implementing declaration is in a separate file.
static partial void Part(C c) //CS0755
{
}
}
public partial class C
{
public static int Main()
{
return 1;
}
}