May 2018
Intermediate to advanced
300 pages
7h 35m
English
The local or nested function, allows you to define a function inside another function. This feature has been available in some programming languages for years, but was just introduced in C# 7. It is desirable to use when you need a function that is small and will not be reusable outside the context of the container method:
class Program{ static void Main(string[] args) { GetNames(out var firstName, out var lastName); void GetNames(out string firstName, out string lastName) { firstName="John"; lastName="Doe"; } }}