csharp_prefer_braces
Add braces to unbraced control-flow bodies. IDE0011. Applied without a compilation.
| Value | Notes |
|---|---|
false |
|
true |
|
when_multiline |
Default: false
csharp_prefer_braces = false
namespace N;
public class Widget
{
public string Classify(int n)
{
if (n > 0)
return "positive";
else if (n < 0)
return "negative";
else
return "zero";
}
}
namespace N;
public class Widget
{
public string Classify(int n)
{
if (n > 0)
return "positive";
else if (n < 0)
return "negative";
else
return "zero";
}
}
csharp_prefer_braces = true
namespace N;
public class Widget
{
public string Classify(int n)
{
if (n > 0)
return "positive";
else if (n < 0)
return "negative";
else
return "zero";
}
}
namespace N;
public class Widget
{
public string Classify(int n)
{
if (n > 0)
{
return "positive";
}
else if (n < 0)
{
return "negative";
}
else
{
return "zero";
}
}
}
csharp_prefer_braces = when_multiline
namespace N;
public class Widget
{
public string Classify(int n)
{
if (n > 0)
return "positive";
else if (n < 0)
return "negative";
else
return "zero";
}
}
namespace N;
public class Widget
{
public string Classify(int n)
{
if (n > 0)
return "positive";
else if (n < 0)
return "negative";
else
return "zero";
}
}