小编shi*_*hon的帖子

System.FormatException的字符串

我收到System.FormatException:运行此方法时输入字符串的格式不正确.

字段的值:

arrayName = "requester";
fieldList = "\"name\" : \"shimshon\""; // "name" : "shimshon"


public override string ToString()
{
   var val = string.Format("\"{0}\" : { {1} }", arrayName, fieldList);

   return val;
}
Run Code Online (Sandbox Code Playgroud)

该方法的期望结果是

"requester" : { "name" : "shimshon" }
Run Code Online (Sandbox Code Playgroud)

这种格式有什么问题?

c# string.format formatexception

3
推荐指数
1
解决办法
4495
查看次数

标签 统计

c# ×1

formatexception ×1

string.format ×1