컴파일러 경고(수준 2) CS0162

업데이트: 2007년 11월

오류 메시지

연결할 수 없는 코드가 있습니다.
Unreachable code detected

실행하지 않는 코드를 컴파일러에서 발견했습니다.

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

// CS0162.cs
// compile with: /W:2
public class A
{
   public static void Main()
   {
      goto lab1;
      {
         // The following statements cannot be reached:
         int i = 9;   // CS0162 
         i++;
      }
      lab1:
      {
      }
   }
}