c# access display name attribute of class object field code example Example: displayname c# [DisplayName("foo")] public string MyProperty { get; set; }