本文介绍了使用日期时间计算年龄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我试图找出如果年龄介于两者之间我该怎么办,例如16-21。 我尝试了什么: 我有一个名为Person的课程。 public string 名称{获得; set ; } public string 姓氏{ get ; set ; } public DateTime年龄{获取; set ; } } 我试图找出确定某些值之间的年龄。所以我们说: 人: 姓名:Blah 姓:Nah 年龄:20岁/> 我试图创建一个if语句,如果年龄介于16到21之间,则说明 等等。 我怎么能这样做? 提前谢谢。解决方案 Hi,I was trying to figure out how could I do something if age is between, for example 16-21.What I have tried:I have a class called Person. public string Name { get; set; } public string Surname { get; set; } public DateTime Age { get; set; }}I was trying to figure out to determine the age between certain values. So let's say that:Person:Name: BlahSurname: NahAge: 20I was trying to create an if statement sayingif age is between 16 and 21 do something etc.How could I do that?Thanks in advance. 解决方案 这篇关于使用日期时间计算年龄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-20 10:07
查看更多