是否可以使用属性为XmlAttributes的HttpClient类进行发布? 例如,我们有课程:
public class request
{
public string attribute1 { get; set; }
public string attribute2 { get; set; }
}
使用PostAsXmlAsync方法。 我必须使用哪些属性来获取这样的请求:
<request attribute1="value" attribute2="value" />
我试图以这种方式使用
[XmlRoot("request")]
public class request
{
[XmlAttribute("attricute1")]
public string attribute1 { get; set; }
[XmlAttribute("attricute1")]
public string attribute2 { get; set; }
}
但得到了结果:
<request>
<attribute1></attribute1>
<attribute2></attribute2>
</request>