In the code snippet below, taken from a Blazor sample, the StartDate property is initialized in the derived SetParameters method while it could be initialized thus:
[Parameter] DateTime StartDate { get; set; } = DateTime.Now;
I wonder if this is a matter of style preference only, or there is a good reason to do so...
@functions {
[Parameter] DateTime StartDate { get; set; }
WeatherForecast[] forecasts;
public override void SetParameters(ParameterCollection parameters)
{
StartDate = DateTime.Now;
base.SetParameters(parameters);
}
}