title: Give a custom name to an Action for debugging
body: <p>I have the following situation:</p>
  <pre><code>var recipe = cookbook.FindRecipe(&quot;mom's chocolate ice cream&quot;);
  var foodItems = new List&lt;IEdible&gt;(recipe.Ingredients);
  
  List&lt;Action&gt; actions =
      (from step in recipe.Steps
       select new Action(() =&gt; step.Execute(foodItems))
      ).ToList();
  
  var cook = new Cook();
  IEdible iceCream = cook.Perform(actions);
  </code></pre>
  <p>This works fine. There's only one problem: the name of an <code>Action</code> is something opaque like <code>{Method = {Void &lt;Process&gt;b__1()}}</code>, so while debugging Visual Studio will show <code>actions</code> to be a list of difficult-to-interpret things.</p>
  <p>Ideally, I would want to pass a custom name, something like this:</p>
  <pre><code>List&lt;Action&gt; actions =
      (from step in recipe.Steps
       let name = $&quot;Execute(foodItems) from {step} of {recipe}&quot;
       select new Action(() =&gt; step.Execute(foodItems), name)
       ).ToList();
  </code></pre>
  <p>and then Visual Studio display my custom name when I'm inspecting the list in the debugger.</p>
  <p>Is there any way to achieve this functionality, or something similar?</p>
  <hr />
  <p>A minimal reproducible example of this issue can be achieved through simple function currying:</p>
  <pre><code>static void Main(string[] args) {
      void DoNothing(int x) { }
      Action action = new(() =&gt; DoNothing(42));
  }
  </code></pre>
  <p>On mouse over <code>action</code>, the debug inspector shows</p>
  <p><a href="https://i.stack.imgur.com/usbi5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/usbi5.png" alt="debug inspector" /></a></p>
  <p>but I would like to give it a custom name instead of  <code>{Method = {Void &lt;Main&gt;b__0_1()}}</code>.</p>