编译器错误 CS0177
在控件离开当前方法之前,必须对 out 参数“parameter”赋值
未向标记有 out 关键字的参数分配方法主体中的值。 有关详细信息,请参阅传递参数
下面的示例生成 CS0177:
C#
// CS0177.cs
public class MyClass
{
public static void Foo(out int i) // CS0177
{
// uncomment the following line to resolve this error
// i = 0;
}
public static void Main()
{
int x = -1;
Foo(out x);
}
}