1

I get the following error when trying to use a delegate with variable number of parameters:

Error 39 Using the generic type 'SlotManager.OrdersConnection.delNewOrderSingle' requires 6 type arguments

What am I doing wrong?

public delegate QuickFix.Message delNewOrderSingle<A,B,C,D,E>(A a, B b, C c, D d, E e);
public delegate QuickFix.Message delNewOrderSingle<A, B, C, D, E, F>(A a, B b, C c, D d, E e, F f);

public virtual QuickFix.Message AgnosticNewOrderSingle42LIMITtest(char side, string symbol, decimal amount, decimal price)
{

            delNewOrderSingle newOrderSingle = new QuickFix.FIX44.NewOrderSingle(
                    new ClOrdID(masterForm.OrderBook.GetNewClOrdIDBroker(ecn.brokerCode)),
                    new Symbol(symbol),
                    new Side(side),
                    new TransactTime(DateTime.Now),
                    ordType = new OrdType(OrdType.LIMIT));


}

NOTE: From Sean's comment I see the question is very wrong. Please see this follo-up

Is it possible to change cast of an object dynamically?

Community
  • 1
  • 1
ManInMoon
  • 6,795
  • 15
  • 70
  • 133

1 Answers1

1

It looks like you're trying to assign an instance of NewOrderSingle to a delegate. You need to assign a method to the delegate, not an object instance.

Also, as the delegate is generic you need to specify the generic types

Did you mean to do this:

delNewOrderSingle<ClOrdID, Symbol, Side, TransactTime, OrdType> newOrderSingle = (a,b,c,d,e) =>  new QuickFix.FIX44.NewOrderSingle(a, b, c, d, e);
Sean
  • 60,939
  • 11
  • 97
  • 136
  • Ah yes. It is NOT a method - what should I use instead of delegate? I want something that "points" to 2 different type of classes... – ManInMoon May 01 '15 at 10:34
  • @ManInMoon - you'll need to explain what you're trying to accomplish in order for me to try to help! – Sean May 01 '15 at 10:38
  • I have re-asked the right question: http://stackoverflow.com/questions/29985539/is-it-possible-to-change-cast-of-an-object-dynamically – ManInMoon May 01 '15 at 10:49