views:

248

answers:

1

Here is the settings file that is leftover from saving. (Saving the properties works correctly.)

<setting name="AlarmList" serializeAs="Xml">
<value>
    <ArrayOfAnyType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
        <anyType xsi:type="ArrayOfAnyType">
            <anyType xsi:type="xsd:dateTime">2009-12-04T02:00:00</anyType>
            <anyType xsi:type="xsd:string">string1</anyType>
            <anyType xsi:type="xsd:string">string2</anyType>
        </anyType>
        <anyType xsi:type="ArrayOfAnyType">
            <anyType xsi:type="xsd:dateTime">2009-12-04T03:00:00</anyType>
            <anyType xsi:type="xsd:string">string1</anyType>
            <anyType xsi:type="xsd:string">string2</anyType>
        </anyType>
    </ArrayOfAnyType>
</value>

How can I load this back into the app using ArrayList? This is how I saved it.

ArrayList list = new ArrayList();
list.Add(SetAlarm.Value);
list.Add("string1");
list.Add("string2");
Settings.AlarmList2.Add(list);
Settings.Save();

Anyone know how I can use this to load the data from the settings?

+2  A: 

I haven't tested this, but I think you can do:

ArrayList all = Settings.AlarmList2;
foreach (ArrayList items in all) {
     // items [0] -> DateTime
     // items [1] -> string1
     // items [2] -> string2
}
Gonzalo
Works! Thank you!
Kevin