By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,214 Members | 1,473 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,214 IT Pros & Developers. It's quick & easy.

Saving a File - a question

P: n/a
Hi all,

at the moment i'm saving a treeview and all its nodes by serialising it
and storing it in a file.
I recently openeing the file which had quite a lot of plain text in it
and noticed that certain phrases repeated themselves throughout the
file many, many times. These phrases seemed to reference properties in
the treeview - which is of course what I expected.

Is there any way I can write the file so that common phrases are
replaced with 'tokens' (probabally the wrong word). And these tokens
are defined at the start of the file.

The reason for this is that I think it would save so much space in the
file.

I'm sure there's a simple explanation for this, but am new to system.IO
- so please be patient!

Thanks,

Gary.

Mar 29 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Why don't you just ZIP the saved file?

Mar 29 '06 #2

P: n/a
That's exacly how zip works - why don't you zip the file?

http://msdn.microsoft.com/msdnmag/is...ipCompression/
http://www.example-code.com/csharp/csCreateZipFile.asp
http://www.gold-software.com/download3321.html

But before you do this - is the file size really a problem? You could
be wasting your time optimising something that doesn't need optimising,
particularly if there's only one file per user. Remember, this will
also slow your application down (very slightly) as it will have to zip
and unzip the file.

Josh
http://www.thejoyofcode.com/

Mar 29 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.