For serializable classes you can write them directly to the stream with a
BinaryFormatter. However, if would prefer the option you have taken as it
decouples you from the RichTextBox as when you move to WPF you would be able
to make it the WPF textbox without changing your code much and without having
to write a converter to convert the saved files.
(This is required as serialized classes need to be reloaded to the same
implementation of the same class)
--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"Mark_B" wrote:
I have an unpredictable number of RichTestBoxes, stored in a generic list,
that are created at runtime. Currently, I am saving these controls to a file
by saving each attribute of each box in string form using a streamwriter.
Later, these attributes are read from the file with a streamreader and the
controls are recreated.
It seems like a cumbersome, inelegant, and inefficient way to save. Is there
another way of saving the entire instance of a control (or any class) in one
shot?