尝试以下(假设出生日期存储在dtDOB):
dtDOB
public int getAgeInYears { TimeSpan tsAge = DateTime.Now.Subtract(dtDOB); return new DateTime(tsAge.Ticks).Year - 1; }