c# - Can this "assignment in conditional expression" be removed without changing behavior? -
c# - Can this "assignment in conditional expression" be removed without changing behavior? -
refactoring legacy app, resharper flagged odd code:
if( retval = util.netsendcommand( returnedcommands.command ) )
the "retval = " part grayed out; assume can remove it. perhaps person wrote code meant equality test, working intended as-is, can safely remove "retval =" correct?
updatehere's code in context:
public bool pendingcommandsexecute_ccrcommand() { bool retval = false; string themessage = new string( '\x00', 1023 ); string command = "ccrcommand"; seek { if (returnedcommands.key != command) homecoming false; hashresultsadd(command, "started"); if( retval = util.netsendcommand( returnedcommands.command ) ) { util.readfinishedchanged += new util.readfinishedhandler( readfinished_hhtcommand ); } else { homecoming false; // commandfailed // ( command // , ": not finish server handshaking \n" // + "failure - ccrcommand!" // ); } } grab (exception ex) { pdaclient.nrbq.exceptionhandler(ex, "pendingcommands.pendingcommandsexecute.hhtcommand"); homecoming false; } homecoming true; }
don't remove it. calling method, doesn't utilize value returns.
c# refactoring resharper equality assignment-operator
Comments
Post a Comment