问题描述:
在C#学习中,经常遇到{1:c},例如如下代码:
<span style="font-size:18px;">Console.WriteLine("{0}需要交{1:c}元电话费", tom.Customername, tom.customerbalance);</span>
<span style="background-color: rgb(255, 255, 255); font-family: Arial, Helvetica, sans-serif;font-size:14px; "><strong>那么,{0}和{1:c}中的元素是代表什么意思呢?</strong></span>
解释:
(1)0和1代表后边参数(tom.Customername 和 tom.customerbalance)的索引值,其中0代表Tom.Customername,1代表Tom.Customerbalance(注意细节:索引值都是从0开始),举一个小例子,例如 :
<span style="font-size:18px;">Console.WriteLine("Hello!,{