如何删除xmlns:i =" http://www.w3.org/2001/XMLSchema-instance"使用DataContractSerializer时。
这就是我得到的:
<ProfileModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Email>wolverine@wolverine.com</Email>
<FirstName>wolverine</FirstName>
<ID>ty1002225</ID>
<LastName>wolverine3</LastName>
<PhoneNumber>66332214477</PhoneNumber>
<SourceSystem>TY</SourceSystem>
</ProfileModel>
我想得到这样的东西:
<ProfileModel>
<Email>wolverine@wolverine.com</Email>
<FirstName>wolverine</FirstName>
<ID>ty1002225</ID>
<LastName>wolverine3</LastName>
<PhoneNumber>66332214477</PhoneNumber>
<SourceSystem>TY</SourceSystem>
</ProfileModel>
这是我的模特:
[DataContract(Namespace = "")]
public class CRMProfileModel
{
[DataMember]
public string FirstName { get; set; }
[DataMember]
public string LastName { get; set; }
[DataMember]
public string Email { get; set; }
[DataMember]
public string PhoneNumber { get; set; }
[DataMember]
public string SourceSystem { get; set; }
[DataMember]
public string ID { get; set; }
}
我试图避免使用字符串替换来删除它。
答案 0 :(得分:0)
如何删除xmlns:i =&#34; http://www.w3.org/2001/XMLSchema-instance"使用DataContractSerializer时。
hii Romeo ...我也尝试了几个小时来删除xmlns:i =&#34; http://www.w3.org/2001/XMLSchema-instance& #34;
最后我找到了最好的,希望它会有所帮助
public IHttpActionResult Post([FromBody] MessageResponse value)
{
>>> pyautogui.hotkey('alt', 'tab')
}