Share via


Advertencia del compilador (nivel 4) CS0649

El campo 'field' nunca se asigna y siempre tendrá su valor predeterminado 'value'

El compilador detectó una declaración de campo privado o interno sin inicializar al que nunca se asignó un valor.

El ejemplo siguiente genera la advertencia CS0649:

// CS0649.cs  
// compile with: /W:4  
using System.Collections;  
  
class MyClass  
{  
   Hashtable table;  // CS0649  
   // You may have intended to initialize the variable to null  
   // Hashtable table = null;  
  
   // Or you may have meant to create an object here  
   // Hashtable table = new Hashtable();  
  
   public void Func(object o, string p)  
   {  
      // Or here  
      // table = new Hashtable();  
      table[p] = o;  
   }  
  
   public static void Main()  
   {  
   }  
}