What class to use for big strings ?

G

Gilbert Tordeur

Hello,

My program is creating pdf files, around 50 - 100 kB each. Today I write
them in text files, then read them back to store into a database. It's
obvious for me that I can save the text file operations by creating a big
string in memory (only append), but it's unclear what class to use : String
StringBuilder, Stream something or ?

My pdf files contain mainly text, but some of them could also contain a jpeg
image.

Thank you for your help,
Gilbert
 
Z

zacks

Hello,

My program is creating pdf files, around 50 - 100 kB each. Today I write
them in text files, then read them back to store into a database. It's
obvious for me that I can save the text file operations by creating a big
string in memory (only append), but it's unclear what class to use : String
StringBuilder, Stream something or ?

My pdf files contain mainly text, but some of them could also contain a jpeg
image.

The typical (as far as I am aware) way of storing binary data into a
database is to use a binary reader and a memory stream.
 
S

Scott M.

If you just need to "store" the string, then String is fine, but if you will
be doing manipulation of the string, then use StringBuilder.

If you want to compact the data, you could write the data out using a
BinaryWriter.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top