• StreamReader or IndexOf
    3 replies, posted
So, me and my friend are competing with making the best program for data storage. Simple structure: Folders, values, folders in folders and so on. The storage is coded in simple text files. Example: [code] <aFolder> aValue = 123 AnotherOne = abc <folderOne> someValue = woodcutter <end> bla = 11 <end> [/code] So now I'm wondering what is the best method; For each value i want to find, a streamreader read lines until it finds the value. [b]OR[/b] when the application initializes it reads the whole file and then use IndexOf to find a value. What is the best method? First thread btw :smug:
If it's optional you could use XML and then XMLTextReader. (.NET has plently of XML manipulation classes) and if you are competing don't you think it's unfair to ask for help from others?
I was just asking because he says he is using IndexOf and that it is better than StreamReader. So I want to know witch one is the best. So it is possible to modify the XML Reader to make it read values and that, like my example?
I figure the IndexOf option is the best. Having to re-read the file each time looks like a waste of processing power to me.
Sorry, you need to Log In to post a reply to this thread.