RCS1259: Remove empty syntax
Properties
| Property | Value |
|---|---|
| Default Severity | Info |
| Minimum language version | - |
Summary
This analyzer reports unnecessary syntax that can be safely removed such as:
- empty destructor
- empty
elseclause - empty
finallyclause - empty
namespacedeclaration - empty object initializer
- empty
#region - empty statement
Examples
Example #1
diagnostic.cs
if (x)
{
Foo();
}
else
{
}
fix.cs
if (x)
{
Foo();
}
Example #2
diagnostic.cs
var sb = new StringBuilder() { };
fix.cs
var sb = new StringBuilder();