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?

update

here'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

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -