Send comments on this topic. |
|
Cause
Rule Description
public object Method()
{
lock (this) {
return this.value;
}
}
When StyleCop checks this code, a violation of this rule will occur because the opening curly bracket of the lock statement is placed on the same line as the lock keyword, rather than being placed on its own line, as follows:
public object Method()
{
lock (this)
{
return this.value;
}
}
A violation will also occur if the closing curly bracket shares a line with other code. For example:
public object Method()
{
lock (this)
{
return this.value; }
}
How to Fix Violations
© Microsoft Corporation. All Rights Reserved.