C# --- Checking the existance of an object that may or may not exist at a certain point in the runtime application
Posted on 2005-03-19
I have a question I neeed help with...
On my form1 I have a function/method that creates an instance of something (not sure whether to call it an object or not). It is basically an API connection to a dll so that I can call methods exposed by another software application via the API dll.
the line looks like this...
public void CreateAPI()
TL = new API2Class();
there is also a using statement so I can do this...
using TL; etc...
Anyway I was wondering how could I check from other forms or classes if this TL exists. For example at different stages in my program I want to check if an instance of TL was created via the line TL = new APIClass(); and if it doesn't exist call the function Form1.CreateAPI()that will then create it if it doesn't exist already?
How do you check if something exists in code if it doesn't? lol :) Any advice?
Please allow me to express my thanks in advance.