title: What are the benefits of C# 7 local functions over lambdas?
body: <p>The other day in one of my utilities, ReSharper hinted me about the piece of code below stating that lambda defining the delegate <code>ThreadStart</code> can be turned into a local function:</p>
  
  <pre><code>public void Start(ThreadPriority threadPriority = ThreadPriority.Lowest)
  {
      if (!Enabled)
      {
          _threadCancellationRequested = false;
  
          ThreadStart threadStart = () =&gt; NotificationTimer (ref _interval, ref _ignoreDurationThreshold, ref _threadCancellationRequested);
  
          Thread = new Thread(threadStart) {Priority = ThreadPriority.Lowest};
          Thread.Start();
      }
  }
  </code></pre>
  
  <p>And hence transformed into:</p>
  
  <pre><code>public void Start(ThreadPriority threadPriority = ThreadPriority.Lowest)
  {
      if (!Enabled)
      {
          _threadCancellationRequested = false;
  
          void ThreadStart() =&gt; NotificationTimer(ref _interval, ref _ignoreDurationThreshold, ref _threadCancellationRequested);
  
          Thread = new Thread(ThreadStart) {Priority = ThreadPriority.Lowest};
          Thread.Start();
      }
  }
  </code></pre>
  
  <p>What are the benefits of the latter over the former, is it only about performance?</p>
  
  <p>I've already checked the resources below but in my example the benefits are not that obvious:</p>
  
  <ul>
  <li><a href="https://asizikov.github.io/2016/04/15/thoughts-on-local-functions/" rel="noreferrer">https://asizikov.github.io/2016/04/15/thoughts-on-local-functions/</a></li>
  <li><a href="https://www.infoworld.com/article/3182416/application-development/c-7-in-depth-exploring-local-functions.html" rel="noreferrer">https://www.infoworld.com/article/3182416/application-development/c-7-in-depth-exploring-local-functions.html</a></li>
  </ul>