因為String.Format會識別{},來用參數代替,但是如果字符串中包含{或者},則需要用{{ 來代替字符 {,用}} 代替 }
例如
json.Append(String.Format("{\"total\":{0},\"row\":{1}}", lineCount, strJSON));
運行時會報錯,
若用如下代碼來代替,則可以正確運行:
json.Append(String.Format("{{\"total\":{0},\"row\":{1}}}", lineCount, strJSON));