如何在 C# 中将显示字符串格式化为货币

How to format display String to currency in C#

我需要将我的显示字符串结果格式化为 C# 中的货币

display = "Service Amount: " + service + "<br>" +   
          "Discount Amount: " + discountAmount + "<br>" +
          "Total: " + total + "<br>";
        lblDisplay.Text = display;

我确实尝试了以下方法:

display = "Service Amount: " + Console.Write(int.ToString("c",service)) + "

但我不知道要放入哪些变量。我只需要它在 returns 字符串之后显示为 $35.00。

String.Format("Service Amount: {0:C}<br>", service)

尝试:

display = string.Format("Service Amount: {0}",service.ToString("C"));
Console.WriteLine(display);

你也可以看看StringBuilder for building strings or String.Format