I faced an easily solved, but design problem, which I had not yet encountered in my young life.
I have a class that needs to go through several setup procedures before anything else happens.
However, during the construction of this class, I have a delegate in the constructor settings, which can be passed so that the user can add his own information to the class.
When this is called, however, the scope that creates the class still does not have a valid instance, and therefore an error occurs with a null exception.
How do I get around this? Should I pass an instance of "this" to this delegate?
What a good decision to make here? I have a "StartServices ()" method, where I could easily pass the call to the delegate, but I believe that its design should be in the constructor.
Thanks for the advice!
source
share