컴파일러 오류 CS0209
업데이트: 2007년 11월
오류 메시지
fixed 문에서 선언된 지역 변수의 형식은 포인터 형식이어야 합니다.
The type of local declared in a fixed statement must be a pointer type
fixed 문에 선언한 변수는 포인터여야 합니다. 자세한 내용은 안전하지 않은 코드 및 포인터(C# 프로그래밍 가이드)를 참조하십시오.
다음 샘플에서는 CS0209 오류가 발생하는 경우를 보여 줍니다.
// CS0209.cs
// compile with: /unsafe
class Point
{
public int x, y;
}
public class MyClass
{
unsafe public static void Main()
{
Point pt = new Point();
fixed (int i) // CS0209
{
}
// try the following lines instead
/*
fixed (int* p = &pt.x)
{
}
fixed (int* q = &pt.y)
{
}
*/
}
}