Share via


컴파일러 오류 CS0230

업데이트: 2007년 11월

오류 메시지

foreach 문에는 형식과 식별자가 모두 필요합니다.
Type and identifier are both required in a foreach statement

foreach 문의 형식이 잘못되었습니다.

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

// CS0230.cs
using System;

class MyClass
{
   public static void Main()
   {
      int[] myarray = new int[3] {1,2,3};

      foreach (int in myarray)   // CS0230
      // try the following line instead
      // foreach (int x in myarray)
      {
         Console.WriteLine(x);
      }
   }
}