-1

I have a class (mydatarec) in my project (client) that is referenced to another project (server). When I call the public double (xxr) in the other project (server) I always get a zero value:

///client///
public class mydatarec
{
   public static double xxr;
}
.
.
static void Main(string[] args)
{
   mydatarec.xxr = 100;
          ...
}

In the other project:

///server///
//When I call it here..
Console.WriteLine(mydatarec.xxr); // I always get 0

I dont know how to continuously change the static double. I need your help!

4

1 回答 1

1

您似乎假设该值由多个进程共享。它不是。静态字段仅在一个进程内共享(或更准确地说,在一个应用程序域内)。

如果您确实需要在进程之间共享内存,请按照问题Shared memory between 2 processes (applications)

于 2013-04-12T16:24:29.283 回答