是什么HttpUtility.HtmlEn code和Server.HtmlEn code之间的差异 [英] What is the difference between HttpUtility.HtmlEncode and Server.HtmlEncode

查看:189
本文介绍了是什么HttpUtility.HtmlEn code和Server.HtmlEn code之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好
是什么在C#HttpUtility.HtmlEn code和Server.HTMLEn code之间的差异
谢谢你们

Hello What is the difference between HttpUtility.HtmlEncode and Server.HTMLEncode in c# Thanks guys

推荐答案

有一个看的 Server.HtmlEn code VS HttpUtility.HtmlEn code

基本上,Server.HtmlEn code使用的是从Page类继承System.Web.HttpServerUtility类的具体实例。 HttpUtility.HtmlEn code是一个静态方法,所以你不必实例化HttpUtility类。

Basically, Server.HtmlEncode uses a specific instance of the System.Web.HttpServerUtility class that's inherited from the Page class. HttpUtility.HtmlEncode is a static method, so you don't have to instantiate the HttpUtility class.

所有其他条件相同,去与静态HttpUtility.HtmlEn code。

All else being equal, go with the static HttpUtility.HtmlEncode.

这篇关于是什么HttpUtility.HtmlEn code和Server.HtmlEn code之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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