S
Steven Blair
Hi,
I have several classes which need to access the same object (a dll). What is
the best way of achieving this?
In C++ I would just have a pointer in a library and #include that library to
all my classes, but obviously cant do this in C#.
I have tried making the object static inside one of my classes and allowed
my other class to speak to the object:
frmMain.m_MyObject.SomeMethod();
I not sure if this is very efficient, or the best way to achieve this.
I was also advised to use something called a Singleton, but to be honest
that gives me the same problem as before:
Singleton.MyObject.SomeMethod();
I am hoping there is a way to mark a variable as global to a whole
namespace, which doesnt require a class to speak to the object.
Any help on this would be appreciated.
Regards,
Steven
I have several classes which need to access the same object (a dll). What is
the best way of achieving this?
In C++ I would just have a pointer in a library and #include that library to
all my classes, but obviously cant do this in C#.
I have tried making the object static inside one of my classes and allowed
my other class to speak to the object:
frmMain.m_MyObject.SomeMethod();
I not sure if this is very efficient, or the best way to achieve this.
I was also advised to use something called a Singleton, but to be honest
that gives me the same problem as before:
Singleton.MyObject.SomeMethod();
I am hoping there is a way to mark a variable as global to a whole
namespace, which doesnt require a class to speak to the object.
Any help on this would be appreciated.
Regards,
Steven