Ways of reading txt file contents into forms?
At work we have a txt file with items recorded in them
The columns are typical of
Apple, *fruit
Cow, *animal
House, *thing
Tree, *plant
Is it possible too read through this txt f开发者_StackOverflow中文版ile to check if apple already exists. I namely want to build a preventative for adding double items...
I think you have to read the file in to a list of objects. In this case, the object will get 2 properties: Type and Category.
After that you can easily perform comparisons etc on the list itself.
Edit: Some stuff for you to read; Reading a file: http://msdn.microsoft.com/en-us/library/system.io.streamreader.readline.aspx
Dictionary: http://msdn.microsoft.com/en-us/library/xfhwa508.aspx
I'm unable to write down an example now, but those are the ingredients.
精彩评论