(可能是一个愚蠢的问题)
// Program_1.exe:
int num = 1;
using (Process process = new Process())
{
process.StartInfo.FileName = "Program_2.exe";
if (process.Start())
{
process.WaitForExit();
}
}
Console.WriteLine(num.ToString()); // num should now equal 2
伪码
// Program_2.exe:
// I want this program to change the value of a variable in Program_1.exe
Program_1.exe->num = 2;
这可能吗?
如果是,我该怎么办?
答案 0 :(得分:1)
您需要使用某种形式的进程间通信,例如WCF。