我需要将Gtotals输出格式化为货币我该怎么做才能实现。我只是从我的代码中抓取了一个快速片段,它不是有序的。
string Lname, Fname, Depart, Stat, Sex, Salary, cDept, cStat, cSex;
double Gtotal;
fields = recordIn.Split(DELIM);
Lname = fields[0];
Fname = fields[1];
Depart = fields[2];
Stat = fields[3];
Sex = fields[4];
Salary = fields[5];
Fname = fields[1].TrimStart(null);
Depart = fields[2].TrimStart(null);
Stat = fields[3].TrimStart(null);
Sex = fields[4].TrimStart(null);
Salary = fields[5].TrimStart(null);
Gtotal = double.Parse(Salary); //convert this to currency? ie. $56,000
答案 0 :(得分:2)
答案 1 :(得分:0)
Gtotal.ToString("C")