C#根据生日计算年龄的方法:

var today = DateTime.Today;//当前日期
var age = today.Year - birthdate.Year;//计算年龄
// 判断生日是否已过,返回准确年龄
if (birthdate > today.AddYears(-age)) age--;
(adsbygoogle = window.adsbygoogle || []).push({});