Using Delegate Dictionary Pattern in Factory with Parameters
<p>I currently have a factory class that looks like this:</p>

<pre><code>public static class OrderFactory
{
    public static Order GetOrder(OrderInformation orderInfo, Logger logger, string overlayPath)
    {
        switch (orderInfo.Type)
        {
            case OrderType.Print:
                return new Print(orderInfo, logger, overlayPath);
            case OrderType.Cad:
                return new Cad(orderInfo, logger, overlayPath);
            case OrderType.Litho:
                return new Litho(orderInfo, logger, overlayPath);
            case OrderType.Error:
            default:
                return new OrderError(orderInfo, logger, overlayPath);
        }
    }
}

public abstract class Order
    {
        protected OrderInformation OrderInfo { get; set; }
        protected Logger Logger { get; set; }
        protected string OverlayPath { get; set; }
        public Order(OrderInformation orderInfo, Logger logger, string overlayPath)
        {
            OrderInfo = orderInfo;
            Logger = logger;
            OverlayPath = overlayPath;
        }
        public abstract Task&lt;bool&gt; CreateImage()
    }

public class Print : Order
    {
        public Print(OrderInformation orderInfo, Logger logger, string overlayPath)
            : base(orderInfo, logger, overlayPath)
        { }

        public override async Task&lt;bool&gt; CreateThumbs(CorelAppWrapper corelAppWrapper, int timeBeforeFirstAbort, int timeBeforeRetryAbort)
        {
</code></pre>

<p>I would like to use a delegate pattern or something else mostly to avoid using a switch statement and also knowing one day we will have to quickly extend this method. I want to use the Delegate Dictionary Pattern or something similar to it.  I tried code like this:</p>

<pre><code>    private delegate Order Order(OrderInformation orderInfo, Logger logger, string overlayPath);

    private static readonly Dictionary&lt;OrderType, Order&gt;
           mTypeConstructors = new Dictionary&lt;OrderType, Order&gt;
           {
               { OrderType.Print, (orderInfo, logger, overlayPath) =&gt; new Print(orderInfo, logger, overlayPath) },
               ...//etc
           };
</code></pre>

<p>Doing it this way throws an error saying that <code>Print</code> type cannot be converted to <code>Order</code> type. What can I do to get around this?</p>