Currently, I am parsing some UNSTRUCTURED text and CONVERT IT TO THIS:
Type1
Type1 Description1 - Type1 Specification1
Type1 Description2 - Type1 Specification2
Type1 Description3 - Type1 Specification3
..more descriptions and specifications
Type2
Type2 Description1 - Type2 Specification1
Type2 Description2 - Type2 Specification2
Type2 Description3 - Type2 Specification3
..more descriptions and specifications
..more Types
etc.
It is a String – spaces and returns delimited.
Although it is easy to read, I understand that this is not efficient way to do this. It is also pretty hard to disassemble it back to initial components(type, description, specification)
My questions:
A. What would be the most efficient way to store this data in memory, and with possibility to save to disk (not in the database) ?
I was thinking about XML, but I never worked with it
and hardly understand it's structure; but if you think
that is the only right way to do it, I guess I would
have to work on it!
B. What would be the best way to present this data in winform , considering that there might be multiple types and multiple type definitions?
Here, I am not sure. I can continue using textbox,
but it also does not seems to be the great way.
Maybe generate HTML and then plug it in? Seems inefficient.
A) Create a class that hold a description and a specification; not sure what it should be called.
Create your own type class that has a list of the above class. (Try not to call it Type though, it would be confused with System.Type.)
As for storing it on a disk, XML isn’t a bad idea, but it is simple enough that you can just put each Type on a single line in a file with a comma (or tab) separated list of description/specification pairs. XML is easier to read in plain text, but more work for a computer to process and will use more space on disk. I would use XML if there is a small amount of data, and I would consider the other options more if there is a lot of it and a person is rarely needing to look at the file.
B) I would use a TreeView.