public void CanAccessSafeSegment()
        {
            int[] numbers = new int[40];
            fixed(int *item = &numbers[0])
            {
                UnsafeMemoryAccess.AddSafeSegment(item, 40 * sizeof(int)); // mark the array as safe memory
                int *mid = item + 20;

                *mid = 42;
                Assert.Equal(42, numbers[20]);
                UnsafeMemoryAccess.RemoveSafeSegment(item);
            }
        }
        public void CannotAccessUnsafeSegment()
        {
            int[] numbers = new int[40];
            fixed(int *item = &numbers[0])
            {
                UnsafeMemoryAccess.AddSafeSegment(item, 40 * sizeof(int)); // mark the array as safe memory
                int *mid = item + 42;

                Assert.Throws <AccessViolationException>(() =>
                {
                    *mid = 42;
                });
                UnsafeMemoryAccess.RemoveSafeSegment(item);
            }
        }