Send comments on this topic. |
|
Glossary Item Box
Cause
Rule Description
For example, the following try-catch statement could be removed completely since the try and catch blocks are both empty.
try
{
}
catch (Exception ex)
{
}
The try-finally statement below does contain code within the try block, but it does not contain any catch blocks, and the finally block is empty. Thus, the try-finally is not performing any useful function and can be removed.
try
{
this.Method();
}
finally
{
}
As a final example, the unsafe statement below is empty, and thus provides no value.
unsafe
{
}
How to Fix Violations
© Microsoft Corporation. All Rights Reserved.