HtmlDocument doc = new HtmlDocument();
doc.Load(yourhtml);
doc.Save(Console.Out);
如何将其保存为字符串而不是 Console.Out
最佳答案
string s = doc.DocumentNode.OuterHtml;
或
var sw = new StringWriter();
doc.Save(sw);
var s = sw.ToString();
关于c# - 如何将 html 文档保存到字符串中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18399694/