What is the idiomatic naming convention for local functions in C# 7 [closed]

My standard is always PascalCase, also spell out the full word. I don’t like abbreviations as they can have multiple meanings.

So, in your PascalCase scenario, I would spell out the ‘Calc’ word to be the following:

public static int Factorial(int n)
{
    return CalculateFactorial(n);

    int CalculateFactorial(int number) => (number < 2)
        ? 1
        : number * CalculateFactorial(number - 1);
}

Compilers have come along ways, and a few extra bytes to make it clear what the method does is worth the few extra keystrokes.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)