我正在尝试POST,然后将JSON响应读入字符串.
我相信我的问题是我需要将自己的对象传递给DataContractJsonSerializer,但我想知道是否有某种方法可以将响应转换为关联数组或某种键/值格式.
我的JSON格式如下:{"license":"AAAA-AAAA-AAAA-AAAA"},我的代码如下:
using (Stream response = HttpCommands.GetResponseStream(URL, FormatRegistrationPost(name, email)))
{
string output = new StreamReader(response).ReadToEnd();
response.Close();
DataContractJsonSerializer json = new DataContractJsonSerializer(typeof(string));
MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(output));
string results = json.ReadObject(ms) as string;
licenseKey = (string) results.GetType().GetProperty("license").GetValue(results, null);
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
有没有一种好方法可以使用单词interop查看两个文档是否相同?
我尝试过使用类似的东西:
Word.Document tempDoc = app.CompareDocuments(document1, document2);
Run Code Online (Sandbox Code Playgroud)
我的问题是tempDoc如果相同则不为null,所以我不确定如何使用此结果来确定文档是否相同.
提前致谢!