I have a 150 MB file. Each line consists of one format, for example /
I,h,q,q,3,A,5,Q,3,[,5,Q,8,c,3,N,3,E,4,F,4,g,4,I,V,9000,0000001-100,G9999999990001800000000000001,G9999999990000001100PDNELKKMMCNELRQNWJ010, , , , , , ,D,Z,
I have a Dictionary<string, List<string>>
It is filled by opening the file, reading each line, taking elements from the line and adding it to the dictionary, after which the file is closed.
StreamReader s = File.OpenText(file); string lineData = null; while ((lineData = s.ReadLine()) != null) { var elements = lineData.Split(','); var compareElements = elements.Take(24); FileData.Add(elements[27], new List<string>(compareElements)); } s.Close();
Using the method in this answer , I calculated that my dictionary is 600 MB. This is 4 times larger than the file.
Does this sound right?