I have a question about a code snippet in my application. x.UsesFeature and Person.UsesFeature are both of type optional bool (bool?). When src.Person.UsesFeature = null, the right side of the ternary operator will be evaulated. My understanding is that the default value of bool? is null. But when this is done mapping, x.UsesFeature is set to False, not null. Why is this happening?
var config = new MapperConfiguration(cfg => cfg.AddProfile<TestProfile>());
. . .then when I map the property in that TestProfile class
.ForMember(x => x.UsesFeature, opt =>
{
opt.MapFrom(src => src.User.UsesFeature.HasValue ? src.User.UsesFeature.Value : default);
})