c# 6.0 - C# 6 how to format double using interpolated string? -
i have used new features of c# 6 incl. interpolated string simple usage (showing message contains string variables $"{employeename}, {department}").
now want use interpolated string showing formatted double value.
example
var anumberasstring = adoublevalue.tostring("0.####");
how can write interpolated string? $"{adoublevalue} ...."
you can specify format string after expression colon (:
):
var anumberasstring = $"{adoublevalue:0.####}";
Comments
Post a Comment