Skip to main content
Code Review

Return to Answer

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

Based on the code in Rev 5 Rev 5 of the question...

private void tryEnableCRUD(bool tryEnable=true)
{
 tsbDelete.Enabled = tsbReplace.Enabled = tsbUpload.Enabled =
 (_securityLevel < 3) && tryEnable;
}

The first line emphasizes that all three variables will be assigned the same value. The second line emphasizes that that value will be true only when _securityLevel is less than 3 and tryEnable is true. The fact that the resulting function is compact is a bonus.

Based on the code in Rev 5 of the question...

private void tryEnableCRUD(bool tryEnable=true)
{
 tsbDelete.Enabled = tsbReplace.Enabled = tsbUpload.Enabled =
 (_securityLevel < 3) && tryEnable;
}

The first line emphasizes that all three variables will be assigned the same value. The second line emphasizes that that value will be true only when _securityLevel is less than 3 and tryEnable is true. The fact that the resulting function is compact is a bonus.

Based on the code in Rev 5 of the question...

private void tryEnableCRUD(bool tryEnable=true)
{
 tsbDelete.Enabled = tsbReplace.Enabled = tsbUpload.Enabled =
 (_securityLevel < 3) && tryEnable;
}

The first line emphasizes that all three variables will be assigned the same value. The second line emphasizes that that value will be true only when _securityLevel is less than 3 and tryEnable is true. The fact that the resulting function is compact is a bonus.

Source Link
200_success
  • 145.5k
  • 22
  • 190
  • 479

Based on the code in Rev 5 of the question...

private void tryEnableCRUD(bool tryEnable=true)
{
 tsbDelete.Enabled = tsbReplace.Enabled = tsbUpload.Enabled =
 (_securityLevel < 3) && tryEnable;
}

The first line emphasizes that all three variables will be assigned the same value. The second line emphasizes that that value will be true only when _securityLevel is less than 3 and tryEnable is true. The fact that the resulting function is compact is a bonus.

lang-cs

AltStyle によって変換されたページ (->オリジナル) /