Dissecting the local functions in C# 7

added by DotNetKicks
10/3/2017 11:52:26 AM

2 Kicks, 373 Views

The Local functions is a new feature in C# 7 that allows defining a function inside another function. When to use a local function? The main idea of local functions is very similar to anonymous methods: in some cases creating a named function is too expensive in terms of cognitive load on a reader.