Simeon Dimov
Simeon Dimov

Reputation: 104

Accessing static members across processes C#

Ok, here is the problem. I have a third party c# lib and im kind of writing a tool about it. So there are a few static Containers that i want to monitor from another application but ofcourse i cant reach them in the domain of my app. A simple example would be :

namespace DefinedInAsembly1
{
     public class Resource
     {
       public static IList<DateTime> DateTimes {get;set;}
     }
}

 namespace DefinedInAssembly2
 {
    class RunningProgram
    {
      static void Main(string[] args)
      {
         while(true)
         {
          Resource.DateTimes.Add(DateTime.Now); 
          Thread.Sleep(10000);
         }
      }
    }
 }

namespace DefinedInAssembly3
{
 class ToolProgram
 {
    static void Main(string[] args)
    {
         //Accessing Resource.DateTimes with the values inserted from RunningProgram
         //Any ideas?
    }

 }
}

Upvotes: 0

Views: 1989

Answers (1)

Tigran
Tigran

Reputation: 62276

You need to use any of available on host OS IPC (Inter Process Commnuication) tecniques:

So applications that have to be listened by someone, should expose themselves via one of these, so another application that would like to sniff, or affect the state of them, can communicate with them via these channels.

Upvotes: 5

Related Questions