我有一个枚举和一个这样的函数
enum DaysOfWeek
{
Sunday = 1,
Monday = 2,
Tuesday = 4,
Wednesday = 8,
Thursday = 16,
Friday = 32,
Saturday = 64
}
public void RunOnDays(DaysOfWeek days)
{
// Do your work here..
}
// Im Calling The Function like this and passing the parameters with Pipe Seprated
RunOnDays(DaysOfWeek.Tuesday | DaysOfWeek.Thursday);
现在场景是在我的用户界面中,我有一些复选框,比如周一到周日,用户可以选择所有天或至少选择一个。我想将选定的值传递给我的函数 RunOnDays。所以它可以是单个值或多个值。如何在选择用户时将值动态传递给该方法。