我正在嘗試將字典集合寫入文件。如何將字典(集合)對象寫入文件(VB .Net 2010)
收集的結構,像這樣:
GlobalCollection (Collection of TestCollection)
(0)
[KEY]
[Value]
- TotalGlobal_W_Count (Integer)
- TotalGlobal_I_Count (Integer)
- TotalGlobal_F_Count (Integer)
TestCollection (Dictionary - Key, Value)
(0)
[KEY]
[Value]
- NumberOfTests (Integer)
- TestCollectionName (String)
- TypesOfTests (ArrayList)
ResultsCollection (Dictionary - Key, Value)
(0)
[KEY]
[Value]
- TotalFcount (Integer)
- TotalIcount (Integer)
- TotalWcount (Integer)
- ID (String)
- TestFolderType(String)
- TestPassed (Boolean)
- FullLog (Array)
ResultsCollection (Dictionary - Key, Value)
(0)
[KEY]
[Value]
- LineNumber (Integer)
- MessageType (String)
- ResultString (String)
我想寫出所有上述變量的文本文件,同時保持層次格式。 (注意每個收集對象中可以有多少個元素)
謝謝!
你看着XML序列化?查看XmlSerializer類。 http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx –