Possible Duplicate:
Setting the default value of a DateTime Property to DateTime.Now inside the System.ComponentModel Default Value Attrbute
Im creating a control like a calendar, and I want user to set de year they want to view. But If they don't, the property of SelectedYear must be the actual year.
I try setting this Default Value like this:
[DefaultValue(DateTime.Today.Year)]
public int SelectedYear{
get{
return _selYear;
}
set{
_selYear = value;
UpdateCalendar();
}
}
And I got the following error
An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type