|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
difference in Filestream + StreamWriter and just StreamWriterand StreamWriter opposed to just a StreamWriter.....for instance Dim fs as New FileStream("C:\Test.txt",...) Dim sw As New StreamWriter(fs) sw.WriteLine("Stuff") sw.Flush() sw.Close() fs.Close() and Dim sw As New StreamWriter("C:\Text.txt") sw.WriteLine("Stuff") sw.Flush() sw.Close() like obviously memory is different since in the first one there are 2 objects created and only one in the second....but what other significant differences are there? should i use one way or another? thanks -- -iwdu15 iwdu15 wrote:
> hi...just a quick question. what are the differences in using a FileStream Not sure about the Writer, but a notable difference with the > and StreamWriter opposed to just a StreamWriter.....for instance StreamReader that you might want to bear in mind. sr = New StreamReader( "file" ) takes a /lock/ on the target file. processes attempting to append data to the file will be blocked from doing so. fs = New FileStream( "file", ... ) sr = New StreamReader( fs ) on the other hand, does not, allowing other processes to write to the file unhindered. HTH, Phill W. |
|||||||||||||||||||||||