String Interpolation

Imperatorn johan_forsberg_86 at hotmail.com
Sat Oct 21 19:11:23 UTC 2023


On Saturday, 21 October 2023 at 19:07:07 UTC, Imperatorn 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;`)
>
> Yes, but it's implied is what I meant

ie

```cs
		string name = "Johan";
		int age = 37;
		string s = $"Hello {name}, you are {age} years old";
		
		Console.WriteLine(s);
```

Would output Hello Johan, you are 37 years old.


More information about the Digitalmars-d mailing list