共用方式為


編譯器警告 (層級 4) CS0649

更新:2007 年 11 月

錯誤訊息

尚未指派欄位 'field',會持續使用其預設值 'value'

編譯器偵測到從未被指派值的未初始化、私用的 (Private) 或內部欄位宣告。

下列範例會產生 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()
   {
   }
}