Send comments on this topic. |
|
Cause
Rule Description
A violation of this rule occurs when parenthesis are used in situations where they provide no practical value. Typically, this happens anytime the parenthesis surround an expression which does not strictly require the use of parenthesis, and the parenthesis expression is located at the root of a statement. For example, the following lines of code all contain unnecessary parenthesis which will result in violations of this rule:
int x = (5 + b);
string y = (this.Method()).ToString();
return (x.Value);
In each of these statements, the extra parenthesis can be removed without sacrificing the readability of the code:
int x = 5 + b;
string y = this.Method().ToString();
return x.Value;
How to Fix Violations
© Microsoft Corporation. All Rights Reserved.