コンパイラの警告 (レベル 4) CS0649

更新 : 2007 年 11 月

エラー メッセージ

フィールド 'field' は割り当てられません。常に既定値 'value' を使用します。

値が代入されていない、初期化されないプライベート フィールドまたは内部フィールドの宣言が検出されました。

次の例では警告 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()
   {
   }
}