Non-Persisted Memory Mapped Files
using System; using System.IO.MemoryMappedFiles; namespace ConsoleApp2 { class Program { static void Main(string[] args) { using (MemoryMappedFile memoryMappedFile = MemoryMappedFile.CreateNew("idg.txt", 5)) { using (MemoryMappedViewAccessor memoryMappedViewAccessor = memoryMappedFile.CreateViewAccessor()) { memoryMappedViewAccessor.Write(0,1); Console.ReadKey(); memoryMappedViewAccessor.Dispose(); memoryMappedFile.Dispose(); } } } } }
using System; using System.IO.MemoryMappedFiles; using System.Threading; namespace ConsoleApp1 { class Program { static void Main(string[] args) { var x = 0; using (MemoryMappedFile memoryMappedFile = MemoryMappedFile.OpenExisting("idg.txt")) using (MemoryMappedViewAccessor memoryMappedViewAccessor = memoryMappedFile.CreateViewAccessor()) { while (true) { var t = memoryMappedViewAccessor.ReadInt32(0); if (x != t) { x = t; Console.WriteLine(t); } Thread.Sleep(1); } } } } }Kaynak:
https://www.infoworld.com/article/2898365/working-with-memory-mapped-files-in-net.html
https://www.buraksenyurt.com/post/Persisted-Memory-Mapped-Files
https://docs.microsoft.com/tr-tr/dotnet/standard/io/memory-mapped-files