컴파일러 오류 CS0573
업데이트: 2007년 11월
오류 메시지
'field declaration' : 구조체에는 인스턴스 필드 이니셜라이저를 사용할 수 없습니다.
'field declaration' : cannot have instance field initializers in structs
구조체의 인스턴스 필드는 초기화할 수 없습니다. 값 형식의 필드는 해당 기본값으로 초기화되고 참조 형식의 필드는 null로 초기화됩니다.
예제
다음 샘플에서는 CS0573 오류가 발생하는 경우를 보여 줍니다.
// CS0573.cs
namespace x
{
public class clx
{
public static void Main()
{
}
}
public struct cly
{
clx a = new clx(); // CS0573
// clx a; // OK
int i = 7; // CS0573
// int i; // OK
}
}