更新:2007 年 11 月
错误消息
yield return 后应为表达式
如果使用 yield 时未包含表达式,则会发生此错误。若要避免此错误,请在语句中插入适当的表达式。
下面的示例生成 CS1627:
// CS1627.cs
using System.Collections;
class C : IEnumerable
{
   public IEnumerator GetEnumerator()
   {
      yield return;   // CS1627
      // To resolve, add the following line:
      // yield return 0;
   }
}
public class CMain
{
   public static void Main() { }
}