我创建了一个Settings类,用于按.ini文件编辑我的应用程序.我的Settings.ini文件看起来像这样:
[ACCOUNT]
login=xyz
password=xyz
locations=1,2,5,8
Run Code Online (Sandbox Code Playgroud)
现在我得到这样的值:
class Settings {
public static IniFile Config = new IniFile(Directory.GetCurrentDirectory() + @"\Settings.ini");
public static string Login { get { return Config.Read("login", "ACCOUNT"); } set { Config.Write("login", "ACCOUNT"); } }
public static string Password { get { return Config.Read("password", "ACCOUNT"); } set { Config.Write("password", "ACCOUNT"); } }
public static int[] Locations { get { return Array.ConvertAll(Config.Read("locations", "ACCOUNT").Split(','), s => int.Parse(s)); } set { Config.Write("locations", "ACCOUNT"); } }
}
Run Code Online (Sandbox Code Playgroud)
问题是,当我的 …
可以说我收集了n工人.可以说有3个:
John
Adam
Mark
Run Code Online (Sandbox Code Playgroud)
我想知道他们什么时候打扫办公室.如果我设置int cleanDays = 3它将是这样的:
//Day of month;worker
1;John
2;John
3;John
4;Adam
5;Adam
6;Adam
7;Mark
8;Mark
9;Mark
10;John
11;John
.
.
.
Run Code Online (Sandbox Code Playgroud)
如果我设置cleanDays = 1它将是:
1;John
2;Adam
3;Mark
4;John
5;Adam
.
.
.
Run Code Online (Sandbox Code Playgroud)
等等.
我已经管理过这样的事情:
int cleanDays = 6;
for (int day=1; day<30;day++) { //for each day
int worker = (day-1 % cleanDays)%workers.Count; //get current worker (starting from index 0)
for (int times=0; times< cleanDays; times++) //worker do the job `cleanDays` …Run Code Online (Sandbox Code Playgroud) c# ×2