Share via


컴파일러 오류 CS0270

업데이트: 2007년 11월

오류 메시지

변수 선언에는 배열 크기를 지정할 수 없습니다. 'new' 식을 사용하여 초기화하십시오.
Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)

이 오류는 배열을 선언할 때 크기를 지정하면 발생합니다. 이 오류를 해결하려면 new Operator 식을 사용합니다.

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

// CS0270.cs
// compile with: /t:module

public class Test
{
   int[10] a;   // CS0270
   // To resolve, use the following line instaead:
   // int[] a = new int[10];
}