المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : convert uint to byte[]



C# Programming
05-04-2009, 07:30 PM
Hi all,

I have a byte[] to unit function, I would like to have a reverse function that convert unit to byte[], please help. thanks a lot.

public static uint ParseUint(byte[] buffer, int uintLengthInBytes, ref int offset)
{
uint value = 0;
int i, j;
for (i = offset + uintLengthInBytes - 1, j = 0; i >= offset; i--, j++)
value |= (uint)(buffer[i]