Now, here is a strange problem I have with String.Format while formatting zero as a hex string. Please take a look at the following example:
    public override string ToString()
    {
        return $"{{{LowPart:X}-{HighPart.ToString("X")}}}";
    }
Above code works alright with HighPart being zero, but the following two give me a wrong result:
    public override string ToString()
    {
        return $"{{{LowPart:X}-{HighPart:X}}}";
    }
    public override string ToString()
    {
        return string.Format("{{{0:X}-{1:X}}}", LowPart, HighPart);
    }
With LowPart being 50 for example and HighPart being 0, both of these will return "{32-X}" instead of "{32-0}".
I don't know the "Why" that this happens. I also tried googling it and found no answer. So here I am to see if anyone have a clue about this.
BTW, I am using VS2015 and .Net4.5
Edit: Turns out that the problem is with the ending }} in the string. Still strange to me though.
Seems like a bug in formatting engine as if I add a space there in the middle, it will work. Like: $"{{{LowPart:X}-{HighPart:X} }}"
 
     
    