44 lines
646 B
Plaintext
44 lines
646 B
Plaintext
== Why is this an issue?
|
|
|
|
Redundant parentheses are simply wasted keystrokes, and should be removed.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,text]
|
|
----
|
|
[MyAttribute()] //Noncompliant
|
|
class MyClass
|
|
{
|
|
public int MyProperty { get; set; }
|
|
public static MyClass CreateNew(int propertyValue)
|
|
{
|
|
return new MyClass() //Noncompliant
|
|
{
|
|
MyProperty = propertyValue
|
|
};
|
|
}
|
|
}
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,text]
|
|
----
|
|
[MyAttribute]
|
|
class MyClass
|
|
{
|
|
public int MyProperty { get; set; }
|
|
public static MyClass CreateNew(int propertyValue)
|
|
{
|
|
return new MyClass
|
|
{
|
|
MyProperty = propertyValue
|
|
};
|
|
}
|
|
}
|
|
----
|
|
|
|
|