how to rollback text

  • Thread starter Thread starter Hakan Fatih YILDIRIM
  • Start date Start date
H

Hakan Fatih YILDIRIM

Hi .net gurus,

Is there a way to rollback a text writen to a text file.I made a loop
that writes text in to a text file and if an exception occurs i want
it to rollback the writen texts?I tried Transactionscope but no
effects on writing texts.

Any ideas?
 
01: Create a new file stream with a new filename
02: Copy the original text content into that stream
03: Write your changes
04: Close the stream
05: Use File.Copy(tempFileName, originalFileName, true) to overwrite the
original
06: Delete the temp file - using a finally block ;-)
 
Back
Top