Re:Strings and the CLR – A Special Relationship
by matthewwarren on Wednesday June 01, 2016 @09:08AM
(#11814034)
I just did a quick test with Reflector and it looks like string interpolation is turned into String.Format(..) calls, which in turn will use StringBuilder. This makes sense as String.Format(..) understands all the string formatting placeholders.
> BTW there is a typo: "passed in my the calling code" should probably be "passed in by the calling code".
Thanks for spotting that, I'll fix it in a bit
BTW there is a typo: "passed in my the calling code" should probably be "passed in by the calling code".
I wonder if the new C# 6 string interpolation also uses string builder like format does. e.g.
https://msdn.microsoft.com/en-us/library/Dn961160.aspxThis post seems to suggest it uses concatenation, which may be bad for performance in some situations due to the immutability.
https://weblogs.asp.net/bleroy/c-6-string-interpolation-is-n...