I personally would save the downloaded files to a temporary folder. You could
hold them in memory but that could cause your app to suck up ram. I would
save them with something like the message id as the name, or make a
Dictionary for the message identifier / path combinations.
The problem I see (although others may see it differently) is that holding
them all in memory will potentially take up a bit of ram if they look through
a lot. This will lead to garbage collections and these strings will be
promoted, potentially to gen 2 which means even when you close your form, you
probably wont garbage collect them for a while and wont get the memory back.
I think streaming the file into a text control which is dumped when the
message is not longer being viewed will keep the strings shortlived so they
will be less likely to get promoted.
HTH
--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"Claire" wrote:
I'm writing an internal mail system module for an application.
The mails are stored on a sql database that may be on a LAN or WAN.
The gui has similar functionality to most email systems where you'd click on
a message header and the message body appears in a read only text box.
To reduce network traffic I plan to download the message body from the
database when a user clicks on the message header and cache it locally until
the form is closed.
Is this the best way to do this? If so, should messages be cached to
temporary files or held in memory or is there a better method?
thank you