How to realize the percentage data formatted by C # Code
This article introduces the relevant knowledge of "how to realize the percentage data formatted by C# code". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Examples of percentage data formatted by C # code:
Decimal _ pre-quarter agreement amount = 0.00m; decimal _ previous quarter payback amount = 0.00m; decimal _ achievement rate = 0.00m; for (int I = 0; I)
< _***季度; i++) { _前季度协议金额 += Convert.ToDecimal( dt客户单产品返利信息.Rows[i]["协议金额"].ToString()); _前季度回款金额 += Convert.ToDecimal( dt客户单产品返利信息.Rows[i]["回款金额"].ToString()); } if (_前季度协议金额 >0) {_ fulfillment rate = _ previous quarterly payback amount / _ prior quarterly agreed amount;} System.Globalization.NumberFormatInfo GN = new System.Globalization.CultureInfo ("zh-CN", false) .NumberFormat; GN.PercentDecimalDigits = 2; GN.PercentDecimalDigits = 2; e.Row.Cells [3]. Text = _ attainment rate .ToString ("P", GN); NumberFormat = 3 / keep three decimal places e.Row.Cells [3] .Text = _ attainment rate .ToString ("P", GN); "how to format percentage data in C # Code" ends here. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!