컴파일러 오류 CS0210

업데이트: 2007년 11월

오류 메시지

fixed 또는 using 문 선언에 이니셜라이저를 입력해야 합니다.
You must provide an initializer in a fixed or using statement declaration

fixed 문의 변수를 선언하고 초기화해야 합니다. 자세한 내용은 안전하지 않은 코드 및 포인터(C# 프로그래밍 가이드)를 참조하십시오.

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

// CS0210a.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)    // CS0210
      {
      }
      // try the following lines instead
      /*
      fixed (int* p = &pt.x)
      {
      }
      fixed (int* q = &pt.y)
      {
      }
      */
   }
}

또한 다음 샘플에서는 using 문에 이니셜라이저가 없어서 CS0210 오류가 발생하는 경우를 보여 줍니다.

// CS0210b.cs

using System.IO;
class Test 
{
   static void Main() 
   {
      using (StreamWriter w) // CS0210
      // Try this line instead:
      // using (StreamWriter w = new StreamWriter("TestFile.txt")) 
      {
         w.WriteLine("Hello there");
      }
   }
}