Why is the code below throwing the Object reference error when it tries to use the ClientSocket?
I copied this example from the Interactive Brokers API documentation.
https://www.interactivebrokers.com/en/software/api/api.htm
I am connected using the IB Gateway.
https://www.interactivebrokers.com/en/index.php?f=5041
I have seen the following post, but it is still not clear what I am doing wrong here.
What is a NullReferenceException, and how do I fix it?
Throws the error on the myClient.ClientSocket line:
var myClient = new EWrapperImpl();
myClient.ClientSocket.eConnect("127.0.0.1", 7496, 0);
Here is the wrapper class:
public class EWrapperImpl : EWrapper
{
EClientSocket clientSocket;
public EWrapperImpl()
{
clientSocket = new EClientSocket(this);
}
public EClientSocket ClientSocket { get; set; }
}