George George

George George

  • NA
  • 778
  • 0

file close issue

Jun 11 2008 1:46 AM

Hello everyone,


Suppose I am using append mode to write to a file using StreamWriter. My application is a long run Windows service. I get the handle of StreamWriter only once during the start of my application by using StreamWriter abc = new StreamWriter (...). I never close the handle abc until application stops, and will use the handle to perform write operations in the runtime of the application.

I only write to the file rarely, for example, there may be no write operation for 2 days or something.

My question is, if I obtain the handle of the StreamWriter too long without any write operations (for example, 2 days or longer), will the handle (or the underlying file) be closed by some parties (e.g. CLR, OS, etc.) -- like timeout of socket?


thanks in advance,
George


Answers (7)