I am developing in C # two simple applications running on the same local computer without network requirements.
The first application initializes the DLL (Class1) and sets the variable. The second application just read the data that was previously saved. Both applications install the same class1.
code:
DLL (Class1):
public class Class1 { private string variableName; public string MyProperty { get { return variableName; } set { variableName = value; } } }
Appendix A:
class Program { static void Main(string[] args) { Class1 class1 = new Class1(); string localReadVariable = Console.ReadLine(); class1.MyProperty = localReadVariable; } }
Appendix B:
class Program { static void Main(string[] args) { ClassLibraryA.Class1 localClass = new ClassLibraryA.Class1(); string z = localClass.MyProperty; Console.WriteLine(z); } }
My problem is that I do not know how to read a variable from another thread.
Application B should read the "variableName" set by application B
thanks
source share