String Interpolation

matheus matheus at gmail.com
Mon Oct 23 14:44:49 UTC 2023


On Monday, 23 October 2023 at 14:12:25 UTC, Rumbu wrote:
> On Saturday, 21 October 2023 at 18:59:13 UTC, Adam D Ruppe 
> wrote:
>> On Saturday, 21 October 2023 at 18:31:10 UTC, Imperatorn wrote:
>>> In C# an interpolated string is just a string
>>
>> This isn't true. It is an object that can convert to string 
>> (similar to D's `alias toString this;`)
>
> In fact neither, it's syntactic sugar.
>
> ```csharp
> int count = 10;
> string s = $"I drink {count} beers";
> ```
>
> is syntactic sugar for:
> ...

Maybe we're talking about the same thing or it changed, but I 
thought it was a syntactic sugar for string.format():

https://web.archive.org/web/20160304034509/https://roslyn.codeplex.com/discussions/570614

Matheus.


More information about the Digitalmars-d mailing list