web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Nishant Rana’s Weblog / New Feature – Local Functio...

New Feature – Local Functions in C# 7.0

Nishant Rana Profile Picture Nishant Rana 11,325 Microsoft Employee

C# 7.0 adds a new feature called local functions.

Local functions allow us to define function within a function. It can be used to write helper methods that we need to use inside that function’s scope.

Here in the below sample code we have defined one main function (MainFunction) that has one local function(MultiplyBy10LocalFunction) defined inside it. And that local function has one more local function(Add10LocalFunction) defined inside it.

Hope it helps..


Filed under: .NET Framework, C# Tagged: .NET Framework, .NET Language, C#

This was originally posted here.

Comments

*This post is locked for comments