我想初始化一个string,datetime
字典,我想要每个字符串的“实时”时间值。稍后我想将字符串作为键插入下拉列表,将日期时间作为值插入。
1 hour (string)- datetime(1 hour value)
5 hour (string)- datetime(5 hour value)
2 days (string)- datetime(2 days value)
3 weeks (string)-datetime(3 weeks value)
我如何制作这种字典?
public Dictionary<string,DateTime> TimeStep()
{
Dictionary<string,DateTime> timestep =
{ "1 Hour", "2 Hours", "5 Hours", "10 Hours", "15 Hours", "24 Hours", "Two Days", "Five Days", "Ten Days", "Two Weeks", "Month" };
return timestep ;
}