错误信息:Exception during StringFormat:输入字符串的格式不正确

 

“System.FormatException”类型的未经处理的异常在 mscorlib.dll 中发生

其他信息: 输入字符串的格式不正确。

 

string s = string.Format("{return:\"{0}\"}", result);//这里报错  

 

后来发现是 占位符 result 里含有 "{}" 大括号导致。

 

解决办法:替换处理result,

用两个 { 或者 }连写表示单个。

 

或者其他办法

相关文章:

  • 2022-12-23
  • 2022-02-08
  • 2022-01-22
猜你喜欢
  • 2022-12-23
  • 2021-08-26
  • 2022-12-23
  • 2021-12-06
  • 2022-12-23
  • 2022-01-26
相关资源
相似解决方案