dimanche 26 avril 2015

Can't create instance of object like normal

I am trying to access information from a API trading position by going

Position position = new Position();
int positionQuantity = position.Net;
Console.WriteLine("position amount is: " + positionQuantity);

However, it is giving me a red line under new Position();

and saying the T4.API.Position has no default constructors defined.

but then if I go

Position position = default(Position); 
int positionQuantity = position.Net;
Console.WriteLine("position amount is: " + positionQuantity);

"object reference not set to an instance of an object"

So it is wanting me to use the "new" keyword but I can't because it says it does not have a default constructor

I opened up their Position class and it does have a bunch of delegates should I use one of those?

did they take out the default constructor for some reason?

Aucun commentaire:

Enregistrer un commentaire