To assign a null value to an anonymous type property you have to cast the null value to the right type so that the compiler knows which type you want for that property.
var employee = new
{
Name = "Fabio Henrique",
Salary = (int?)null,
HasEmail = (bool?)null,
};
Comments