Is there a noticable performance difference between using string interpolation:
myString += $"{x:x2}";
vs String.Format()?
myString += String.Format("{0:x2}", x);
I am only asking because Resharper is prompting the fix, and I have been fooled before.
Noticable is relative. However: string interpolation is turned into string.Format()
at compile-time so they should end up with the same result.
There are subtle differences though: as we can tell from this question, string concatenation in the format specifier results in an additional string.Concat()
call.