From: mp on 29 Mar 2010 19:57 given a sorted dictionary of sorted dictionaries Private m_profilesDict As Dictionary(Of String, Object) = New Dictionary(Of String, Object) If m_profilesDict.ContainsKey(ProfileName) Then ProfileDict = m_profilesDict.Item(ProfileName) Else ProfileDict = New SortedDictionary(Of Double, String) m_profilesDict.Add(ProfileName, ProfileDict) End If If ProfileDict.ContainsKey(dlength) Then .... Else ProfileDict.Add(dlength, "to be determined") End If so at runtime i might have M_ProfileDict.Item ("A") ProfileDict.Item("25").Value = "1" ProfileDict.Item("36").Value = "2" ProfileDict.Item("45").Value = "3" M_ProfileDict.Item ("C") ProfileDict.Item("15").Value = "1" ProfileDict.Item("26").Value = "2" ProfileDict.Item("35").Value = "3" M_ProfileDict.Item ("D") ProfileDict.Item("27").Value = "1" ProfileDict.Item("39").Value = "2" ProfileDict.Item("41").Value = "3" what would be an easy way to store to file and read back from file in another session of the app? I didn't notice a SortedDictionary.Serialize(Filename) property on the object. :-) thanks mark
From: Mr. Arnold on 29 Mar 2010 23:41 mp wrote: > given a sorted dictionary of sorted dictionaries > Private m_profilesDict As Dictionary(Of String, Object) = New Dictionary(Of > String, Object) > > what would be an easy way to store to file and read back from file in > another session of the app? > I didn't notice a SortedDictionary.Serialize(Filename) property on the > object. > :-) You can unload the data out of the dictionary creating an object of each item and load the object into a List<T>. http://support.microsoft.com/kb/316730 Here is a C# example of how to serialize/deserialize a List<T> of objects to/from a file. I am sure you can find a VB.Net example use Google to find it. http://dotnetperls.com/serialize-list-tutorial Of course, the object has to be known by both programs.
From: mp on 30 Mar 2010 00:52 excellent! thanks for the links mark "Mr. Arnold" <Arnold(a)Arnold.com> wrote in message news:%23qaw1r7zKHA.4752(a)TK2MSFTNGP04.phx.gbl... > mp wrote: >> given a sorted dictionary of sorted dictionaries >> Private m_profilesDict As Dictionary(Of String, Object) = New >> Dictionary(Of String, Object) >> >> what would be an easy way to store to file and read back from file in >> another session of the app? >> I didn't notice a SortedDictionary.Serialize(Filename) property on the >> object. >> :-) > > You can unload the data out of the dictionary creating an object of each > item and load the object into a List<T>. > > http://support.microsoft.com/kb/316730 > > Here is a C# example of how to serialize/deserialize a List<T> of objects > to/from a file. I am sure you can find a VB.Net example use Google to find > it. > > http://dotnetperls.com/serialize-list-tutorial > > Of course, the object has to be known by both programs. >
|
Pages: 1 Prev: container for tables & queries in VB.NET 2008 Next: Weird application exit |