All rules
IDE0061Language rules (expression-bodied members)

Use expression body for local functions

Use expression body for local functions

Microsoft docs

Description

This style rule concerns the use of expression bodies versus block bodies for local functions. Local functions are private methods of a type that are nested in another member.

Example

// csharp_style_expression_bodied_local_functions = true
void M()
{
    Hello();
    void Hello() => Console.WriteLine("Hello");
}

// csharp_style_expression_bodied_local_functions = false
void M()
{
    Hello();
    void Hello()
    {
        Console.WriteLine("Hello");
    }
}

Configurable options

Vote for the value each option should take in the generated .editorconfig.

csharp_style_expression_bodied_local_functions
default: false
Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0