How to check if the text file is open and close the text file?

后端 未结 5 1095
忘了有多久
忘了有多久 2020-12-06 15:38

I am trying to save the text file in this path:\"C:\\Test\\test.txt\" and when the file is already opened I need to check whether the file is opened and I need to close it b

5条回答
  •  天涯浪人
    2020-12-06 16:12

    I was having this problem with a .csv file my program attaches to an email. I added code to clear the Attachments collection in the MailMessage object then disposing the MailMessage and Attachment objects after the mail is sent. That appears to have fixed the problem.

提交回复
热议问题