How to initialize this dictionary

前端 未结 3 1486
别那么骄傲
别那么骄傲 2021-01-29 10:42

I want to initialize a string,datetime dictionary, I want a \"real\" time value for each string. Later I want to insert the strings into drop down list as keys and

3条回答
  •  有刺的猬
    2021-01-29 11:26

    var dic = new Dictionary()
              {
                    {"1  Hour", TimeSpan.FromHours(1)},
                    {"Two days", TimeSpan.FromDays(2)}
              };
    

提交回复
热议问题