Beispiel #1
0
    public void Test3()
    {
        Pointer <int> p1 = stackalloc int[4];
        Pointer <int> p2 = stackalloc int[4];

        var rg2 = new[] { 1, 2, 3, 4 };

        p1.WriteAll(rg2);
        p1.Copy(p2, rg2.Length);

        for (int i = 0; i < rg2.Length; i++)
        {
            Assert.True(p1[i] == p2[i]);
        }

        p2.Clear(rg2.Length);
        p1.Copy(p2, 1, rg2.Length - 1);
        var rg1 = new[] { 2, 3, 4 };

        for (int i = 1; i < rg1.Length - 1; i++)
        {
            Assert.True(p2[i] == p1[i + 1]);
        }
    }