我正在使用
例如:
System.ComponentModel.DataAnnotations
为我的Entity Framework 4.1项目提供验证。例如:
public class Player
{
[Required]
[MaxLength(30)]
[Display(Name = "Player Name")]
public string PlayerName { get; set; }
[MaxLength(100)]
[Display(Name = "Player Description")]
public string PlayerDescription{ get; set; }
}
我需要获取Display.Name
注解的值,以在消息中显示,例如:所选择的“玩家名称”为Frank。
=================================================================================
我需要获取注解的另一个例子:
var playerNameTextBox = new TextBox();
playerNameTextBox.MaxLength = GetAnnotation(myPlayer.PlayerName, MaxLength);
我该怎么做?