Mik*_*ang 2 c# vb6 if-statement
我正在将一个vb6应用程序转换为c#,我遇到了一些我不太了解的东西.我从未见过if语句结构,其中被评估的表达式实际上是"true"或"false".
private bool InitializeForProgramming() //OK
{
if (J1939.getReplyStatus() == modJ1939.dmOpFailed) //or OpComplete (dmBusy auto cycles)
{
//check the Pointer value to see if engineRunning, or already in Mode
if (true) //let it proceed *** ??
{
//nothing to do
}
else
{
lblCommun.Text = "ProgramMode Failed!";
lblCommun.ForeColor = Color.Red;
//could report more detailed reasons! (engineRunning, etc.)
return true; //FAILED!
}
}
Run Code Online (Sandbox Code Playgroud)
这里用if(true)表达式评估什么?如果是真的?
这是原始的vb6代码:
Private Function InitializeForProgramming() As Boolean 'OK
If getReplyStatus = dmOpFailed Then 'or OpComplete (dmBusy auto cycles)
'check the Pointer value to see if engineRunning, or already in Mode
If (True) Then 'let it proceed *** ??
'nothing to do
Else
txtCommun.Text = "ProgramMode Failed!"
txtCommun.ForeColor = vbRed
'could report more detailed reasons! (engineRunning, etc.)
InitializeForProgramming = True 'FAILED!
Exit Function
End If
End If
Run Code Online (Sandbox Code Playgroud)
如果您需要我提供其他任何内容以帮助我获得答案,请告诉我.
这很可能是由于过去被删除的情况造成的.也就是说,曾经有一个条件if
,但不再是.您应检查源控件历史记录以获取对该行的更改.
if
在这种情况下,您可以删除整个语句以进行重写.此外,C#可能会抱怨并非所有代码路径都返回该方法的值.
归档时间: |
|
查看次数: |
123 次 |
最近记录: |