DisplayName
sets the DisplayName
in the model metadata. For example:
[DisplayName("foo")]
public string MyProperty { get; set; }
and if you use in your view the following:
@Html.LabelFor(x => x.MyProperty)
it would generate:
<label for="MyProperty">foo</label>
Display
does the same, but also allows you to set other metadata properties such as Name, Description, ...
Brad Wilson has a nice blog post covering those attributes.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…