Error del compilador CS0210

Actualización: noviembre 2007

Mensaje de error

Debe proporcionar un inicializador en una declaración de instrucción fixed o using
You must provide an initializer in a fixed or using statement declaration

Se debe declarar e inicializar la variable de una instrucción fixed. Para obtener más información, vea Código no seguro y punteros (Guía de programación de C#).

El código siguiente genera el error 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)
      {
      }
      */
   }
}

El siguiente ejemplo también genera el error CS0210 porque la instrucción using no tiene inicializador.

// 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");
      }
   }
}