title: C# MemoryMappedFile changed event
body: <p>How to notify listeners that MemoryMappedFile created via CreateNew() has been changed? I do not have MemoryMappedFile physically on disc. I want second process starts reading from MMF when MMF is changed by first process. Similar to FileSystemWatcher.Changed event. </p>
  
  <pre><code>MemoryMappedFile mmf = MemoryMappedFile.CreateNew("testmap", 10000);
  // Second process has been started and waiting for data in MMF                                          
  // Writing could be performed multiple times
  using (MemoryMappedViewStream stream = mmf.CreateViewStream())
  {
       BinaryWriter writer = new BinaryWriter(stream);
       writer.Write("hello world!");
  }
  </code></pre>
  
  <p>Second process code:</p>
  
  <pre><code>// The code below should executes when writing to "testmap" file was finished. 
  using (MemoryMappedFile mmf = MemoryMappedFile.OpenExisting("testmap"))
  {
       using (MemoryMappedViewStream stream = mmf.CreateViewStream())
       {
            BinaryReader reader = new BinaryReader(stream);
            Console.WriteLine("Process A says: {0}", reader.ReadString());
       }               
  }
  </code></pre>
  
  <p>Updated. Solution is to use <a href="https://docs.microsoft.com/en-us/dotnet/standard/io/how-to-use-named-pipes-for-network-interprocess-communication" rel="nofollow noreferrer">Named Pipes MSDN</a> as it was suggested by Piotr.</p>