<pre>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DataTest { class ByteBlock { // 8 Bytes and Offset for Byte Block private byte _00 = 0x00; private byte _01 = 0x00; private byte _02 = 0x00; private byte _03 = 0x00; private byte _04 = 0x00; private byte _05 = 0x00; private byte _06 = 0x00; private byte _07 = 0x00; private int _offset; private List<ByteBlock> list = new List<ByteBlock>(); // List of ByteBlocks to return for List/Data Grid public ByteBlock(byte[] data, int offset) { // Loop throught the provided data and build List of ByteBlocks with 8x Bytes and calculated offset's // Set each byte value and the offset, then add the object to the List byte[] _byteArray = data; int _numberOfBytes = data.Count(); int _blockSize = 8; int _offset = offset; byte[] tmpDat = new byte[_numberOfBytes]; do { Buffer.BlockCopy(_byteArray, _offset, tmpDat, _offset, _blockSize); // copy a block _offset += _blockSize; // increment the offset _numberOfBytes -= _blockSize; // decrement the number remaining if (_numberOfBytes < _blockSize) // if remainder is less than the blocksize _blockSize = _numberOfBytes; // set the blocksize to remainder for last block } while (_numberOfBytes > 0); } // Public Interface methods for data grid public int Offset { get { return _offset; } } public byte i00 { get { return _00; } } public byte i01 { get { return _01; } } public byte i02 { get { return _02; } } public byte i03 { get { return _03; } } public byte i04 { get { return _04; } } public byte i05 { get { return _05; } } public byte i06 { get { return _06; } } public byte i07 { get { return _07; } } } }