【发布时间】:2015-02-25 14:37:22
【问题描述】:
我正在将一个 vb6 应用程序转换为 c#,但我遇到了一些我不太理解的东西。我从未见过一个 if 语句结构,其中被评估的表达式实际上是“真”或“假”。
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!
}
}
这里用表达式 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
如果您需要我提供任何其他内容来帮助我获得答案,请告诉我。
【问题讨论】:
-
我喜欢这条线
InitializeForProgramming = True 'FAILED!
标签: c# if-statement vb6