Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/281.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 错误CS0177:输出参数';Wx';必须在控件离开当前方法之前指定给_C# - Fatal编程技术网

C# 错误CS0177:输出参数';Wx';必须在控件离开当前方法之前指定给

C# 错误CS0177:输出参数';Wx';必须在控件离开当前方法之前指定给,c#,C#,在方法的开头写上: pass1.cs(51,18): error CS0177: The out parameter 'Wx' must be assigned to before control leaves the current method pass1.cs(51,18): error CS0177: The out parameter 'Wy' must be assigned to before control leaves the current method pass1.cs(5

在方法的开头写上:

pass1.cs(51,18): error CS0177: The out parameter 'Wx' must be assigned to before control leaves the current method
pass1.cs(51,18): error CS0177: The out parameter 'Wy' must be assigned to before control leaves the current method
pass1.cs(51,18): error CS0177: The out parameter 'Vx' must be assigned to before control leaves the current method
pass1.cs(51,18): error CS0177: The out parameter 'Vy' must be assigned to before control leaves the current method

在方法的开头写上:

pass1.cs(51,18): error CS0177: The out parameter 'Wx' must be assigned to before control leaves the current method
pass1.cs(51,18): error CS0177: The out parameter 'Wy' must be assigned to before control leaves the current method
pass1.cs(51,18): error CS0177: The out parameter 'Vx' must be assigned to before control leaves the current method
pass1.cs(51,18): error CS0177: The out parameter 'Vy' must be assigned to before control leaves the current method

我认为错误信息是不言自明的。放

Wx = 0f;
Wy = 0f;
Vx = 0f;
Vy = 0f;

在方法的顶部。我可以从您的逻辑中看出,代码保证在返回之前将值设置为某个值,但编译器用于确定该值的静态分析相对简单,有时有点悲观。

我认为错误消息是不言自明的。放

Wx = 0f;
Wy = 0f;
Vx = 0f;
Vy = 0f;

在方法的顶部。我可以从您的逻辑中看出,代码保证在返回之前将值设置为某个值,但编译器用于确定该值的静态分析相对简单,有时有点悲观。

Morten就是这样的人!工作得很有魅力。基于错误消息,我认为这是一个不明显的解决方案。谢谢莫顿,桑尼·莫顿就是那个人!工作得很有魅力。基于错误消息,我认为这是一个不明显的解决方案。谢谢莫顿,孩子