public unsafe void TestIndexAccessors() { // Define variables and constants const int WIDTH = 4; const int HEIGHT = 8; const int DEPTH = 2; byte * ptr = stackalloc byte[WIDTH * HEIGHT * DEPTH]; RawResourceDataView1D <byte> view1D = new RawResourceDataView1D <byte>((IntPtr)ptr, 1U, WIDTH); RawResourceDataView2D <byte> view2D = new RawResourceDataView2D <byte>((IntPtr)ptr, 1U, WIDTH, HEIGHT, WIDTH); RawResourceDataView3D <byte> view3D = new RawResourceDataView3D <byte>((IntPtr)ptr, 1U, WIDTH, HEIGHT, DEPTH, WIDTH, WIDTH * HEIGHT); // Set up context for (int i = 0; i < WIDTH * HEIGHT * DEPTH; ++i) { ptr[i] = (byte)i; } // Execute // Assert outcome Assert.AreEqual((byte)3, view1D[3]); Assert.AreEqual((byte)22, view2D[2, 5]); Assert.AreEqual((byte)54, view3D[2, 5, 1]); }
public DataViewEnumerator(RawResourceDataView1D <TEnum> parent) { this.parent = parent; Reset(); }
/// <summary> /// Indicates whether the current object is equal to another object of the same type. /// </summary> /// <returns> /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false. /// </returns> /// <param name="other">An object to compare with this object.</param> public bool Equals(RawResourceDataView1D <T> other) { return(Data == other.Data && Width == other.Width && sizeOfT == other.sizeOfT); }