Beispiel #1
0
        public void CreateAndCleanup()
        {
            var file = Path.Combine(_tempFolders.CreateRandomTempFolder(), "CreateAndCleanup.mmf");

            using (var mmf = new MemoryFile(file, 100))
            {
                Assert.Equal(100, mmf.FileLength);
                var spanAll     = mmf.GetSpan();
                var span40Len10 = mmf.GetSpan(40, 10);
                var bytes       = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
                bytes.CopyTo(span40Len10);
                Assert.Equal(7, spanAll[47]);
                spanAll[^ 1] = 42;