The support for local functions is an excellent new feature that has been introduced in C# 7. Note that you can define local functions inside any method, the constructor of a class or inside a property — both getter and setter. When it’s compiled by the C# compiler, a local function gets transformed into a private method.When developing applications, you might often need to create methods that aren’t reused — you need them just for modularity. You might not want your methods to be long as maintaining such methods would become a nightmare over time. However, you might end up having many private methods that would not be reused, right? This new feature in C# 7 comes to the rescue in such circumstances — you can define functions that are local to another scope, or it can be inside another function or even inside a property (both getter and setter).To read this article in full or to leave a comment, please click here

Leave a Reply