为什么XML实体在C#字符串中保留文字值?

问题描述 投票:0回答:1

我有一个带有回车符的XML元素:

<expectedValue>Success:&#13;&#10;Your Payment information has been updated!</expectedValue>

我曾期望将其反序列化为具有字符串属性的对象时,它们将显示为C#转义字符,例如:

Success:\r\nYour Payment information has been updated!

但是该字符串仍然带有文字实体值:

Success:&#13;&#10;Your Payment information has been updated!

有没有办法像我期望的那样对它进行反序列化?

c# xml string
1个回答
0
投票

看看SecurityElement.Escape,您会看到所有已编码/已解码的字母。如果您进一步非xml编码xml中的数据,则必须对其进行相应解码。

© www.soinside.com 2019 - 2024. All rights reserved.