将DateTime数组加载到ListBox中?

时间:2009-12-05 06:28:15

标签: c# arrays datetime settings.settings

如何使用DateTime格式保存Properties.Settings.Default.Array(只是时间)?

1 个答案:

答案 0 :(得分:0)

好的,我发现了这个

添加设置,键入select browse并找到System.Collection.ArrayList。

用于保存值

if (Properties.Settings.Default.test == null)
   Properties.Settings.Default.test = new System.Collections.ArrayList();
Properties.Settings.Default.test.Add(new DateTime(2009, 1, 1));
Properties.Settings.Default.Save();

用于检索值

System.Collections.ArrayList list = Properties.Settings.Default.test;
for (int iDate = 0; iDate < list.Count; iDate++)
{
   DateTime dateValue = (DateTime)list[iDate];
}

查看Using Settings in C#