I would like to convert an Int32
in the range 0-15
into a the corresponding char
in hexadecimal. One really dummy solution consists in writing
var hex = new[] {'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
var myCharInHex = hex[myValue];
Yet, this solution looks plain wrong, any better suggestion?