public static int ToHex(ushort value, char[] hexBuffer, int offset)
{
if (hexBuffer == null) throw new ArgumentNullException("hexBuffer");
if (offset < 0) throw new ArgumentOutOfRangeException("offset");
const int maxLength = 4;
if (value == 0)
{
hexBuffer[offset + 0] = '0';
hexBuffer[offset + 1] = '0';
hexBuffer[offset + 2] = '0';
hexBuffer[offset + 3] = '0';
}
else
{
hexBuffer[offset + 0] = HexChar[(value >> 4) & 15u];
hexBuffer[offset + 1] = HexChar[value & 15u];
hexBuffer[offset + 2] = HexChar[(value >> 4 * 3) & 15u];
hexBuffer[offset + 3] = HexChar[(value >> 4 * 2) & 15u];
}
return maxLength;
}
public static int ToHex(byte value, char[] hexBuffer, int offset)