displayName属性VS显示属性 [英] displayname attribute vs display attribute

查看:196
本文介绍了displayName属性VS显示属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么区别显示名称属性和在ASP.NET MVC中显示属性?

What is difference between DisplayName attribute and Display attribute in ASP.NET MVC?

推荐答案

他们俩给你相同的结果,但重点不同我看到的是,你不能指定显示名称属性的ResourceType。对于MVC 2的例子,你必须继承的显示名称属性通过本地化提供的资源。显示属性(新的MVC3和.NET4)支持的ResourceType超载作为一个开箱即用属性。

They both give you the same results but the key different I see is that you cannot specify a ResourceType in DisplayName attribute. For an example in MVC 2, you had to subclass the DisplayName attribute to provide resource via localization. Display attribute (new in MVC3 and .NET4) supports ResourceType overload as an "out of the box" property.

这篇关于displayName属性VS显示属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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