Closed
Description
My model includes a DateTime?
property
public class CampaignDesignerRequest
{
//...
public DateTime? CampaignStartDate { get; set; }
//...
}
My view inherits the model
@inherits RazorEngineCore.RazorEngineTemplateBase<Fourstarzz.Accessors.ReportTemplates.Models.DesignedCampaign_RenderModel>
At write time, the intellisense recognizes CampaignStartDate as a nullable and shows an error hint if I try to run date string formatting without specifying .Value
Model.CampaignStartDate.Value.ToShortDateString()
However when I run the code, it gives me the error
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException : 'System.DateTime' does not contain a definition for 'Value'
I've tested the same on other value types, like int and double, and get the same kind of error.
Versions
- RazoreEngineCore 2020.9.1
- .NET framework 4.8.
Any thoughts on potential causes?
Metadata
Metadata
Assignees
Labels
No labels