编译器错误 CS1629
更新:2007 年 11 月
错误消息
迭代器中不能出现不安全的代码
C# 语言规范不允许迭代器中出现不安全的代码。
下面的示例生成 CS1629:
// CS1629.cs
// compile with: /unsafe
using System.Collections.Generic;
class C
{
IEnumerator<int> IteratorMeth() {
int i;
unsafe // CS1629
{
int *p = &i;
yield return *p;
}
}
}