If you need to be able to store a large amount of plain text in memory so it can be searched and edited, what kind of datatype would you use?
Let’s say I load a 10000 line document into my C# application for searching with LINQ, how would you represent it in memory?
Not a string, because it’s got be mutable, and strings are immutable.
You could always use a MemoryStream and then use a StreamReader to read the data from memory.
You might get some lift from the following link which talks about using LINQ with a StreamReader. I’m not sure if it fits exactly what you’re trying to do though.
http://blogs.msdn.com/ericwhite/archive/2006/08/31/linq-to-text-files.aspx
From the blog post:
You’d want to change the StreamReader instantiation to something like
or something similar.