System.HexConvert.ToHex C# (CSharp) Method

ToHex() public static method

public static ToHex ( byte value, char hexBuffer, int offset ) : int
value byte
hexBuffer char
offset int
return int
		public static int ToHex(byte value, char[] hexBuffer, int offset)
		{
			if (hexBuffer == null) throw new ArgumentNullException("hexBuffer");
			if (offset < 0) throw new ArgumentOutOfRangeException("offset");

			const int maxLength = 2;

			if (value == 0)
			{
				hexBuffer[offset] = '0';
				hexBuffer[offset + 1] = '0';
			}
			else
			{
				hexBuffer[offset] = HexChar[(value >> 4) & 15u];
				hexBuffer[offset + 1] = HexChar[value & 15u];
			}

			return maxLength;
		}

Same methods

HexConvert::ToHex ( uint value, char hexBuffer, int offset ) : int
HexConvert::ToHex ( ulong value, char hexBuffer, int offset ) : int
HexConvert::ToHex ( ushort value, char hexBuffer, int offset ) : int
HexConvert::ToHex ( byte buffer ) : string
HexConvert::ToHex ( byte buffer, int offset, int count ) : string