如何将数据转换为字符串

时间:2015-07-27 09:03:58

标签: c# asp.net

如何在单个字符串变量中获取十进制数组值

decimal[] Fld_Frmk_Param3 = { 561568, 223915, 480070, 0, 453, 7.64M, 0 };

string a=???..

3 个答案:

答案 0 :(得分:3)

这应该做到

%

答案 1 :(得分:2)

decimal [] Fld_Frmk_Param3 = {561568,223915,480070,0,453,7.64M,0};

        StringBuilder sb = new StringBuilder();

        foreach (decimal res in Fld_Frmk_Param3)
        {
            sb.Append(res+",");
        }
        Console.WriteLine(sb);

答案 2 :(得分:0)

您可以使用String.Join操作:

decimal[] Fld_Frmk_Param3 = { 561568, 223915, 480070, 0, 453, 7.64M, 0 };
string a = String.Join(", ", Fld_Frmk_Param3);

给你:

"561568, 223915, 480070, 0, 453, 7.64M, 0"