컴파일러 오류 CS1642
업데이트: 2007년 11월
오류 메시지
고정 버퍼 필드는 구조체의 멤버로만 사용할 수 있습니다.
Fixed size buffer fields may only be members of structs.
이 오류는 struct 대신 class에서 고정 크기 버퍼 필드를 사용하는 경우에 발생합니다. 이 오류를 해결하려면 class를 struct로 변경하거나 필드를 일반 배열로 선언합니다.
예제
다음 샘플에서는 CS1642 오류가 발생하는 경우를 보여 줍니다.
// CS1642.cs
// compile with: /unsafe /target:library
unsafe class C
{
fixed int a[10]; // CS1642
}
unsafe struct D
{
fixed int a[10];
}
unsafe class E
{
public int[] a = null;
}