相关疑难解决方法(0)

如何让XDocument.Load保留换行符

using (System.IO.StreamReader sr = new System.IO.StreamReader(path, System.Text.Encoding.GetEncoding("Windows-1252"), true))
{ 

    xdoc = XDocument.Load(sr);
}
Run Code Online (Sandbox Code Playgroud)

这是我的XML

<sheet name="sheet1" bounds="160,128,464,288">
    <text name="text1" bounds="160,128,464,288" text="a

    b"/>
</sheet>
Run Code Online (Sandbox Code Playgroud)

XDocument.Load转换

a

b
Run Code Online (Sandbox Code Playgroud)

a b
Run Code Online (Sandbox Code Playgroud)

如何保留我的换行符?

.net c#

4
推荐指数
1
解决办法
1361
查看次数

标签 统计

.net ×1

c# ×1