So yesterday I saw this tutorial on c# and I learned about string interpolation. I've always programmed in java and just used the + to add strings. Now I'm trying to find out why you would use interpolation over just adding these strings. For example:
int number = 203;
System.IO.Directory.CreateDirectory("C:/Temp/" + number);
I feel like this works perfectly and no reason why I should use interpolation. Interpolation for example:
int number;
System.IO.Directory.CreateDirectory("C:/Temp/{0}", number);
When I googled it, I found a performance test. In this test they found that interpolating is slower than adding both 2 variables to a string.
Could anyone please explain to me why or when I should use interpolation over adding, since interpolation performes worse?