title: C# Convert Action<Car> to Action<List<Car>
body: <p>I have a method which takes in an argument of <code>Action&lt;List&lt;Car&gt;</code>  which is invoked on a list in that method. (method 2)</p>
  
  <p>In another method which calls aforementioned method I have an <code>Action&lt;Car&gt;</code> as input argument.</p>
  
  <p>When the invoke in method 2 happens I want my <code>Action&lt;Car&gt;</code> from method 1 to be invoked. </p>
  
  <p>I have no clue how to convert <code>Action&lt;Car&gt;</code> to <code>Action&lt;List&lt;Car&gt;</code> Without invoking stuff already in the method which has the action on the Car only.</p>
  
  <p>Example (<a href="http://rextester.com/STWWVO99830" rel="nofollow noreferrer">http://rextester.com/STWWVO99830</a>):</p>
  
  <pre><code>class Program
  {
      public static void Main(string[] args)
      {
          var car = ExpectCar(model =&gt;
          {
              foreach (var type in model.Types)
              {
                  type.Name = "SuperStarShineType";
              }
          });
      }
  
  
  
      public static Car ExpectCar(Action&lt;Car&gt; preProcessor)
      {
          var car = new Car();
          preProcessor.Invoke(car);
  
          var carList = new List&lt;Car&gt; { car };
          var carActionList = new Action&lt;List&lt;Car&gt;&gt;(list =&gt; list = carList);
  
          return ExpectCars(carActionList).Single();
      }
  
  
      public static List&lt;Car&gt; ExpectCars(Action&lt;List&lt;Car&gt;&gt; preProcessor)
      {
          var carList = new List&lt;Car&gt; {
              new Car {
                  Types = new List&lt;Type&gt; {
                      new Type {Name = "SuperCar"}
                  }
              }
          };
  
          preProcessor.Invoke(carList);
  
          return carList;
      }
  
  }
  class Car
  {
      public List&lt;Type&gt; Types { get; set; }
  }
  
  public class Type
  {
      public string Name { get; set; }
  }
  </code></pre>
  
  <p>It gives me a null reference exception because the types are empty because I invoked to early. The invoke needs to happen only in the second method.</p>