Share via


컴파일러 오류 CS1101

업데이트: 2007년 11월

오류 메시지

매개 변수 한정자 'ref'는 'this'와 함께 사용할 수 없습니다.
The parameter modifier 'ref' cannot be used with 'this'.

this 키워드는 정적 메서드의 첫 번째 매개 변수를 수정할 때 메서드가 확장 메서드임을 컴파일러에 알립니다. 확장 메서드의 첫 번째 매개 변수에 다른 한정자가 필요하지 않거나 사용할 수 없습니다.

예제

다음 예제에서는 CS1101 오류가 발생하는 경우를 보여 줍니다.

// cs1101.cs
// Compile with: /target:library
public static class Extensions
{
    // No type parameters.
        public static void Test(ref this int i) {} // CS1101

    // Single type parameter.
        public static void Test<T>(ref this T t) {}// CS1101

    // Multiple type parameters.
        public static void Test<T,U,V>(ref this U u) {}// CS1101
}

참고 항목

참조

확장 메서드(C# 프로그래밍 가이드)

this(C# 참조)

ref(C# 참조)