c# double type retains several decimal places

C or c : currency

D or d: decimal number

E or e : scientific notation (exponent)

F or f: fixed point

G or g: regular

N or n: number

P or p: percentage

double.ToString("Nx "); //where x is the number of digits you need to retain, for example, N2 is to retain two decimal places.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325232151&siteId=291194637