I am building a Blazor WebAssembly application with a separate ASP.NET Core Web API project. I would like to create a new List including the users date of birth and other date times. I am getting Compiler Error CS0029: cannot implicitly convert type 'int' to 'System.DateTime'. If I add quotes, I get an error of 'string' to 'System.DateTime'. What is the correct way to set the DateTime property value in a new list?
Controller
public class Controller : ControllerBase
{
List<Person> people = new List<Person>
{
new Person {Id = 1, Name = "John Doe", DOB = YYYY-MM-DD HH:MM:SS},
new Person {Id = 2, Name = "Jane Doe", DOB = YYYY-MM-DD}
};
}
Model
public class Person
{
public int Id { get; set; }
public string Name { get; set; }
public DateTime DOB { get; set; }
}