C#

C#

By DeepSource

Consider dropping attribute's parenthesis CS-R1101

Anti-pattern
Autofix

In a method's case, irrespective of whether it take arguments or not, they must have parenthesis. However, this is not the case for attributes. If an attribute does not take parameters, you can safely drop the parenthesis.

Bad Practice

[MyCustomAttribute()] // Takes no parameters
public void Method()
{
    // ...
}

Recommended

[MyCustomAttribute] // Parenthesis dropped
public void Method()
{
    // ...
}