PDA

View Full Version : Cannot convert method group 'ToString' to non-delegate type 'string'. Did you intend


MindSabre
07-11-2007, 05:36 AM
What's wrong with this code? It generates the error:

Cannot convert method group 'ToString' to non-delegate type 'string'. Did you intend to invoke the method?

Code:

string Str1, Str2;
Str1=Position.MarketPosition.ToString;
Str2=Position.Quantity.ToString;
Print(Str1);
Print(Str2);

NinjaTrader_Dierk
07-11-2007, 06:34 AM
ToString() is a method not a property. Should read:

Str1=Position.MarketPosition.ToString();
Str2=Position.Quantity.ToString();

MindSabre
07-11-2007, 07:13 AM
Obvious...