共用方式為


編譯器錯誤 CS0186

更新:2007 年 11 月

錯誤訊息

在此內容中使用 null 無效

下列範例會產生 CS0186:

// CS0186.cs
using System;
using System.Collections;

class MyClass 
{
   static void Main() 
   {
      // Each of the following lines generates CS0186:
      foreach (int i in null) {}   // CS0186
      foreach (int i in (IEnumerable) null) { };   // CS0186
   }
}