System.HexConvert.CopyBufferToHexBuffer C# (CSharp) Method

CopyBufferToHexBuffer() public static method

public static CopyBufferToHexBuffer ( byte buffer, int offset, int count, char hexBuffer, int hexBufferOffset ) : void
buffer byte
offset int
count int
hexBuffer char
hexBufferOffset int
return void
		public static void CopyBufferToHexBuffer(byte[] buffer, int offset, int count, char[] hexBuffer, int hexBufferOffset)
		{
			if (buffer == null) throw new ArgumentNullException("buffer");
			if (offset < 0) throw new ArgumentOutOfRangeException("offset");
			if (count < 0) throw new ArgumentOutOfRangeException("count");
			if (offset + count > buffer.Length) throw new ArgumentOutOfRangeException("count");
			if (hexBuffer == null) throw new ArgumentNullException("hexBuffer");
			if (hexBufferOffset < 0) throw new ArgumentOutOfRangeException("hexBufferOffset");
			if (hexBufferOffset + count * 2 > hexBuffer.Length) throw new ArgumentOutOfRangeException("hexBufferOffset");

			if (count == 0)
				return;

			var end = offset + count;
			for (var index = offset; index < end; index++)
			{
				var value = buffer[index];
				hexBuffer[hexBufferOffset] = HexChar[(value >> 4) & 15u];
				hexBuffer[hexBufferOffset + 1] = HexChar[value & 15u];
				hexBufferOffset += 2;
			}
		}
		public static void CopyHexBufferToBuffer(char[] hexBuffer, int offset, int count, byte[] buffer, int bufferOffset)