I recently noticed that ReSharper (2016.3) now says to remove redundant parentheses on C # statements, which I believe will lead to a change in the intended behavior. This statement:
private bool GetAutoAdjust( int catType )
{
return ( catType == ChargeTypeIds.Penalty && _appSettingRepository.AutoRemovePen ) ||
( catType == ChargeTypeIds.Interest && _appSettingRepository.AutoRemoveInt ) ||
( catType == ChargeTypeIds.Discount && _appSettingRepository.AutoRemoveDis );
}
Really equivalent to this?
private bool GetAutoAdjust( int catType )
{
return catType == ChargeTypeIds.Penalty && _appSettingRepository.AutoRemovePen ||
catType == ChargeTypeIds.Interest && _appSettingRepository.AutoRemoveInt ||
catType == ChargeTypeIds.Discount && _appSettingRepository.AutoRemoveDis ;
}
Perhaps I am mistaken in how C # evaluates OR clauses compared to something like SQL Server, but does not OR evaluates the expression only LEFT from it and right to it, or does it actually pre-concatenate all AND conditions before condition assessment OR?
source
share