I am starting out with MVC 4 (Razor view engine). (I believe this may apply to MVC 3 and earlier as well.) I am wondering if there is any benefit to using the DisplayAttribute d
One of the benefits is you can use it in multiple views and have a consistent label text. It is also used by asp.net MVC scaffolding to generate the labels text and makes it easier to generate meaningful text
[Display(Name = "Wild and Crazy")]
public string WildAndCrazyProperty { get; set; }
"Wild and Crazy" shows up consistently wherever you use the property in your application.
Sometimes this is not flexible as you might want to change the text in some view. In that case, you will have to use custom markup like in your second example