컴파일러 오류 CS0185

업데이트: 2007년 11월

오류 메시지

'type'은(는) lock 문에 필요한 참조 형식이 아닙니다.
'type' is not a reference type as required by the lock statement

lock 문에서는 참조 형식만 사용할 수 있습니다. 자세한 내용은 스레드 동기화(C# 프로그래밍 가이드)참조 형식(C# 참조)을 참조하십시오.

예제

다음 샘플에서는 CS0185 오류가 발생하는 경우를 보여 줍니다.

// CS0185.cs
public class MainClass
{
    public static void Main ()
    {
        lock (1)   // CS0185
        // try the following lines instead
        // MainClass x = new MainClass();
        // lock(x)
        {
        }
    }
}