Share via


컴파일러 오류 CS0213

업데이트: 2007년 11월

오류 메시지

이미 고정된 식의 주소를 가져오는 데 fixed 문을 사용할 수 없습니다.
You cannot use the fixed statement to take the address of an already fixed expression

unsafe 메서드의 지역 변수 또는 매개 변수가 이미 스택에 고정되었으므로 fixed 식에 있는 두 변수의 주소를 가져올 수 없습니다. 자세한 내용은 안전하지 않은 코드 및 포인터(C# 프로그래밍 가이드)를 참조하십시오.

예제

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

// CS0213.cs
// compile with: /unsafe
public class MyClass
{
   unsafe public static void Main()
   {
      int i = 45;
      fixed (int *j = &i) { }  // CS0213
      // try the following line instead
      // int* j = &i;

      int[] a = new int[] {1,2,3};
      fixed (int *b = a)
      {
         fixed (int *c = b) { }  // CS0213
         // try the following line instead
         // int *c = b;
      }
   }
}