I have read questions like this: How do I calculate someone's age in C#?. Say I wanted to establish whether a date of birth makes a person over 21 years old. Could I do this:
if (dateOfBirth.Date <= DateTime.Now.AddYears(-21).Date
{
//Do something because the person is over 21.
}
Here I have just one line of code to get the age. The approaches in the other question have two or more - that is why I am asking. Is my approach slower or something?