Why use a hex literal for an int?
c#, hex, int
Solution
In some cases HEX value is more rounded and understandable than its decimal equivalent. Like 0x0FFF, 0xA0A0, 0x10000, etc.
Problem
Whilst reading over some existing code I came across: ``` public static readonly int MaxSize = 0x1000; ``` Which made me wonder why use a hex literal. In this context MaxSize is used for pagination. The closest I came to was: Hex numbers are a convenient way of expressing integral values, denoting exactly the bits stored in memory for that integer. https://csharp.2000things.com/2010/08/28/72-hexadecimal-numbers/ Which makes sense to a degree, I'd be interested in hearing a more detailed explanation for this use case in particular "denoting exactly the bits stored in memory".