HtmlDecode在C#库中

时间:2017-05-31 10:15:31

标签: c#

我有一个C#库,可以向api发送Web请求。

我收到这个字符串:

Appartement de 42m² en vente à 225 000€, Bagnolet

我想用WebUtility.HtmlDecode

解码&#...字符

但是,在参考向导中,我找不到system.net.webutility。 你知道我怎么能参考这个组件?

谢谢!

Ps:我使用的是C#4.6 enter image description here

2 个答案:

答案 0 :(得分:0)

请注意,如果您正在编写非ASP.NET应用程序,则自.NET 4.0(WebUtility Methods)起,System.Net.WebUtility中的某些方法会重复出现,因此您不需要依赖在ASP.NET程序集上执行HTML编码和解码。

答案 1 :(得分:0)

using System.Net;

var decodedtext = WebUtility.HtmlDecode(text);
相关问题