G
Guest
Hello there,
I've just come accross this and wonder if i'm taking the best approach?
I read a byte[] array from the registry, this byte array is basically an
array of Int32 so i wish to revert and store this Int32 array,
I do so as follows
Byte[] byteViewColWidths = (Byte[])objViewColWidths;
m_nNumCols = byteViewColWidths.Length / Marshal.SizeOf(typeof(Int32));
m_arrColWidths = new Int32[m_nNumCols];
int nIntOffset = 0;
for (int nIdx = 0; nIdx < m_nNumCols; nIdx = nIdx + 4, ++nIntOffset)
m_arrColWidths[nIntOffset] = BitConverter.ToInt32(byteViewColWidths, nIdx);
basically convert every 4 bytes to an interger.
Is this best approach?
thanks in advance
Brian
I've just come accross this and wonder if i'm taking the best approach?
I read a byte[] array from the registry, this byte array is basically an
array of Int32 so i wish to revert and store this Int32 array,
I do so as follows
Byte[] byteViewColWidths = (Byte[])objViewColWidths;
m_nNumCols = byteViewColWidths.Length / Marshal.SizeOf(typeof(Int32));
m_arrColWidths = new Int32[m_nNumCols];
int nIntOffset = 0;
for (int nIdx = 0; nIdx < m_nNumCols; nIdx = nIdx + 4, ++nIntOffset)
m_arrColWidths[nIntOffset] = BitConverter.ToInt32(byteViewColWidths, nIdx);
basically convert every 4 bytes to an interger.
Is this best approach?
thanks in advance
Brian