I have used interpolated strings for messages containing string
variables like $"{EmployeeName}, {Department}"
. Now I want to use an interpolated string for showing a formatted double
.
Example
var aNumberAsString = aDoubleValue.ToString("0.####");
How can I write it as an interpolated string? Something like $"{aDoubleValue} ...."
You can specify a format string after an expression with a colon (:
):
var aNumberAsString = $"{aDoubleValue:0.####}";