6
6tc1
Hi all, I'm having a problem where in my solution that contains
multiple projects - I instantiate a singleton class in one assembly and
then if another assembly tries to use that singleton class another
instance of it is created.
Basically:
--Assembly 1 (the executable)--
-Main.cs-
Singleton singleton = Singleton.Instance;
singleton.setValue("test");
--Assembly 2--
-Foo.cs-
Singleton singleton = Singleton.Instance;
String testing = singleton.getValue();
Console.Out.Writeline("test: "+testing);
The console outputs null because apparently two asseblies can't use the
singleton pattern in a cohesive manner?
Novice
multiple projects - I instantiate a singleton class in one assembly and
then if another assembly tries to use that singleton class another
instance of it is created.
Basically:
--Assembly 1 (the executable)--
-Main.cs-
Singleton singleton = Singleton.Instance;
singleton.setValue("test");
--Assembly 2--
-Foo.cs-
Singleton singleton = Singleton.Instance;
String testing = singleton.getValue();
Console.Out.Writeline("test: "+testing);
The console outputs null because apparently two asseblies can't use the
singleton pattern in a cohesive manner?
Novice