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

MEmory stream, file stream

P: n/a
While retriving an image i came across two streams
Filestream and Memorystream. can anyone guide me when
should i use which?
Nov 15 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Pums <an*******@discussions.microsoft.com> wrote:
While retriving an image i came across two streams
Filestream and Memorystream. can anyone guide me when
should i use which?


Well, what exactly do you want to do? A FileStream reads/writes from/to
a file; a MemoryStream reads/writes from/to memory.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #2

P: n/a
Actually i am retriving an image from sql server. It's in
binary. i want to assign that image to a picturebox. now
for that i can create write that binary as a byte stream
in memory stream or i can create a temporary file by
using filestream. Sometimes u might now have writable
permisssion to a folder. in that case you can't create
that file by using filestream.

So, my point was to exactly know the scenerio where we
should use filestream or memorystream only. Right now for
my application i can use both. but, there may be cases
where i need to use any one of them. I wanted to know
those cases.
Nov 15 '05 #3

P: n/a
Pums <an*******@discussions.microsoft.com> wrote:
Actually i am retriving an image from sql server. It's in
binary. i want to assign that image to a picturebox. now
for that i can create write that binary as a byte stream
in memory stream or i can create a temporary file by
using filestream. Sometimes u might now have writable
permisssion to a folder. in that case you can't create
that file by using filestream.

So, my point was to exactly know the scenerio where we
should use filestream or memorystream only. Right now for
my application i can use both. but, there may be cases
where i need to use any one of them. I wanted to know
those cases.


I would personally go for a MemoryStream here - I can't see that using
a FileStream buys you anything, really. In terms of cases where you
need to use one in particular - if you don't want a file involved, use
a MemoryStream, and if you do, use a FileStream.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #4

P: n/a
Thanks.
Nov 15 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.