With the existing String.Format
, I could throw the format string in a database or resource file, instead of having it hard coded into my application. Is that possible with Interpolation?
I'm guessing not, as it seems to be a compiler checked thing.
No, it's a compiler thing as this:
string result = $"{name}";
Is compiled into this:
string result = string.Format("{0}", name);
And you can't run the compiler on these stored strings.
You can store the strings with the numbered parameters though, and use string.Format
explicitly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With