Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我用这个例子来序列化这样的字典
Dictionary<object, object>
我得到的是
{ "key": "value" }
我需要的是
{ key: "value" }
我如何获得这个输出?
错误的方法 - 现在我使用一个简单的字符串生成器。
foreach (DictionaryEntry entry in xSet) { result.AppendFormat("{0}: '{1}',", entry.Key, HttpUtility.JavaScriptStringEncode(entry.Value.ToString())); }