I have a dictionary that looks something like this
public Dictionary<string,List<ForwardBarrelRecord>> lexicon = new Dictionary<string, List<ForwardBarrelRecord>>();
with ForwardBarrelRecord
looking like this
public struct ForwardBarrelRecord
{
public string DocId;
public int hits { get; set; }
public List<int> hitLocation;
}
I want to write everything down to the list of int in the forward barrel record on a file. So that when i retrieve it i can make an exact reconstruction of the dictionary.
So far i have written the code but it only saves the key in the dictionary and instead of making a copy of value just writes the class path. So far my code is
using (var file = new System.IO.StreamWriter("myfile.txt"))
{
foreach (var entry in pro.lexicon)
{
file.WriteLine("[{0} {1}]", entry.Key, entry.Value);
}
}
I am looking to make a deep copy of everything in this dictionary of mine.
Any help would be appreciated.