c#中2或条件的简写
本文关键字:条件 | 更新日期: 2023-09-27 18:16:56
我在c#中有以下语句
if(user.member.RegistrationDate.Value.Month == 10 || user.member.RegistrationDate.Value.Month == 11)
我的问题是,有没有一种方法可以把它速记下来,例如;
if(user.member.RegistrationDate.Value.Month == 10 || 11)
if (new []{10,11}.Contains( user.member.RegistrationDate.Value.Month))