是否等效于ASP.NET 5中的MvcHtmlString? [英] Equivalent for MvcHtmlString in ASP.NET 5?

查看:46
本文介绍了是否等效于ASP.NET 5中的MvcHtmlString?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ASP.NET 5中是否有MvcHtmlString的等效项? 否则,我们如何才能正确呈现自定义HTMLHelper方法的HTML输出?

解决方案

不再需要MvcHtmlString(出于兼容性原因将其添加到HtmlString之上),因此您可以简单地使用Microsoft.AspNet.Mvc.Rendering.HtmlString.

您可以很容易地注意到,Asp.Net 5的ViewComponents和Helpers也在视图中使用(通过返回)相同的HtmlString.

Is there an equivalent for MvcHtmlString in ASP.NET 5 ? Otherwise, how can we render HTML output from my custom HTMLHelper method properly ?

解决方案

There is no longer need for MvcHtmlString (which added on top of HtmlString for compatibility reasons) so you can simply use Microsoft.AspNet.Mvc.Rendering.HtmlString.

As you can easily notice, the ViewComponents and Helpers of Asp.Net 5 are also using (by returning) the same HtmlString to the views.

这篇关于是否等效于ASP.NET 5中的MvcHtmlString?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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