Practice mode C#

What is a local function in C#?

Correct answer C. A method declared inside another method and visible only within it

Explanation

Since C# 7, you can declare a named method inside the body of another member. It is private to that member, can capture its local variables and parameters, and can be recursive or generic. Local functions are useful for helper logic and for validating arguments eagerly in iterator or async methods. There is no local access modifier in C#.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.