2009-12-07 3 views
2

다음은 저장시 남은 설정 파일입니다. (속성을 올바르게 작동합니다 저장.)Properties.Settings에서 ArrayList로로드 하시겠습니까?

<setting name="AlarmList" serializeAs="Xml"> 
<value> 
    <ArrayOfAnyType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
     <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> 

어떻게 ArrayList의를 사용하여 응용 프로그램에 다시이 문제를로드 할 수 있습니다? 이것은 저장 한 방법입니다.

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

누구나 설정에서 데이터를로드하는 데 사용할 수있는 방법을 알고 계십니까?

+1

.NET 1.1 또는 2.0 또는 3.5? – Fredou

+0

.net 3.5 C를 사용하여 # – Kevin

답변

2

나는이 테스트를하지 않은,하지만 난 당신이 할 수 있다고 생각 :

ArrayList all = Settings.AlarmList2; 
foreach (ArrayList items in all) { 
    // items [0] -> DateTime 
    // items [1] -> string1 
    // items [2] -> string2 
} 
+1

작동! 고맙습니다! – Kevin