Which out of the following two equivalent ways would be best for the null conditional operator in terms of primarily performance and then ease of use or clarity etc.?
This:
idString = child?.Id;
fatherName = child?.Father?.Name;
motherName = child?.Mother?.Name;
or (assuming that all local vars are null already) this:
if (child != null)
{
idString = child.Id;
fatherName = child.Father?.Name;
motherName = child.Mother?.Name;
}
Is performance even an issue?