$4.99

Saving Data (XDEV8210)

0 ratings
I want this!

Saving Data (XDEV8210)

$4.99
0 ratings

Introducing a simple method for saving a data structure.

For many programs, saving data is relatively trivial. Text in an EditField can be saved to a simple text file, or the contents of a listbox can be saved in a tab-delimitated file. Both of these tasks can easily be automated for simple reuse (for instance, it's not hard to create EditField or Listbox subclasses that know how to save and reload themselves from a file).

But many programs require a slightly more complicated data structure than mere text. Even if the data itself is fairly straightforward, it may be scattered apart in different areas of your program (i.e., some in a Listbox, some in an EditField, some elsewhere), or it may simply be that you have different kinds of data (numbers and text and colors and pictures) and they can't all be easily stored in a single file.

I had a vague dream: wouldn't it be great if there was a pre-written routine, a class or module or something, where I could just pass it my data structure and it would auto-magically save and retrieve the entire thing no matter what the structure or what it contained? Just imagine how much easier that would make developing a new program!

Okay, so that's still a fantasy, and probably will never happen, but I've created something that takes me part of the way there. Instead of trying to create something that will save every type of data structure, I've settled on my favorite data structure, the dictionary object. Dictionaries are awesome because they can contain almost anything (even other dictionaries). They provide lightening quick access, can be dynamically adjusted, and are nearly as easy to use as arrays.

What I have done is create a system of dictionary extensions and datatype classes that allow the contents of a dictionary object to be saved to/loaded from a disk file. I have unimaginatively called this "SaveDict."

I want this!
Size
752 KB
Copy product URL