HtmlEn $ C $从类库Ç [英] HtmlEncode from Class Library

查看:87
本文介绍了HtmlEn $ C $从类库Ç的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类库(在C#)。我需要带code。使用HtmlEn code方法我的数据。这是很容易从Web应用程序做的。我的问题是,我该如何使用此方法从类库,正在从一个控制台应用程序叫什么名字?

I have a class library (in C#). I need to encode my data using the HtmlEncode method. This is easy to do from a web application. My question is, how do I use this method from a class library that is being called from a console application?

推荐答案

导入的System.Web
或拨打其中包含它的System.Web.HttpUtility

Import System.Web Or call the System.Web.HttpUtility which contains it

您需要将引用添加到DLL,如果它不存在的话

You will need to add the reference to the DLL if it isn't there already

string TestString = "This is a <Test String>.";
string EncodedString = System.Web.HttpUtility.HtmlEncode(TestString);

这篇关于HtmlEn $ C $从类库Ç的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆