C# 13 Programming Essentials - .NET 9 Edition: Learn C# and .Net 9 Programming using Visual Studio Code by Neil Smyth

C# 13 Programming Essentials - .NET 9 Edition: Learn C# and .Net 9 Programming using Visual Studio Code by Neil Smyth

Author:Neil Smyth
Format: epub


16.9 Lambdas vs. local functions

In general, the choice between lambdas and local functions is a matter of personal coding style, though there are some advantages to using local functions such as direct access to local variables and recursion. Local functions are also considered to be more efficient than lambdas because they do not require the allocation of a delegate.

It is worth noting that when you write a lambda in VS Code, the editor will often suggest that you convert it to a local function, which hints at Microsoft’s opinion on the matter:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.