C# 7.0 adds a new feature called local functions, which allows local methods to be defined and called within a method. This wasn’t possible in the previous versions. The following code snippet defines a method named "Add" inside the "Main" method and calls within the "Main" method.
As its name suggests, a local function is available to the method it is defined inside only.
Local functions is a new concept introduced in C# 7.0. In this article, we learned how to write and use a local function.
References used to write this article,