In C#7, I'm trying to use a multiline interpolated string for use with FormttableString.Invariant but string concatenation appears to be invalid for FormttableString.
Per the documentation: A FormattableString instance may result from an interpolated string in C# or Visual Basic.
The following FormttableString multiline concatenation does not compile:
using static System.FormattableString;
string build = Invariant($"{this.x}"
+ $"{this.y}"
+ $"$this.z}");
Error CS1503 - Argument 1: cannot convert from 'string' to 'System.FormattableString'
Using an interpolated string without concatenation does compile:
using static System.FormattableString;
string build = Invariant($"{this.x}");
How do you implement multiline string concatenation with the FormattableString
type?
(Please note that FormattableString was added in .Net Framework 4.6.)