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

Popular posts from this blog

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -