我正在尝试将 JSON 格式的字符串转换为字典,见下文:
using namespace System::Web::Script::Serialization;
...
String ^data = "{Name: 'sherlock', Problem: 'deserialization'}";
JavaScriptSerializer ^serializer = gcnew JavaScriptSerializer();
Dictionary<String^, Object^> obj = serializer->Deserialize<Dictionary<String^, Object^>>(data);
我收到一个错误,
class "System::Collections::Generic::Dictionary<System::String ^, System::Object ^>" has no suitable copy constructor
我是来自 c# 的 c++/cli 新手。我想我理解什么是复制构造函数,但我不确定为什么在这种情况下需要一个,或者如何解决这个错误..
谢谢