コンパイラ エラー CS1623
更新 : 2007 年 11 月
エラー メッセージ
反復子には ref または out パラメータを指定できません。
このエラーは、反復子のメソッドに ref パラメータまたは out パラメータが定義されている場合に発生します。このエラーを回避するには、メソッド シグネチャから ref キーワードまたは out キーワードを削除します。
使用例
次の例では CS1623 エラーが生成されます。
// CS1623.cs
using System.Collections;
class C : IEnumerable
{
public IEnumerator GetEnumerator()
{
yield return 0;
}
// To resolve the error, remove ref
public IEnumerator GetEnumerator(ref int i) // CS1623
{
yield return i;
}
// To resolve the error, remove out
public IEnumerator GetEnumerator(out float f) // CS1623
{
f = 0.0F;
yield return f;
}
}