I have an autogenerated class from importing a web service containing something like this (abbreviated):
[System.Runtime.Serialization.DataMemberAttribute()]
public System.DateTime StartDate
{
get
{
return this.StartDateField;
}
set { }
}
And I want to add an MVC format attribute to this member. Therefore, in another file containing the same definition partial class, I would like to do something like the following (which is illegal):
[DisplayFormat(DataFormatString = "{0:dd-MM-yyyy}", ApplyFormatInEditMode = true)]
public DateTime StartDate;
The partial method is useless here because partial methods must be private, have a return type, must be a method, etc. etc.
How can I decorate this item?
source
share