流读取器错误 [英] Stream Reader Error

查看:88
本文介绍了流读取器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的一个Outlook插件我开发了一个表单(主表单)以在手动按钮单击事件中加载,并且该主表单正在使用stremreader访问某些源文件

但是当主窗体关闭时,尝试使用Outlook手动按钮再次打开它会给错误消息msg
错误该进程无法访问文件"C:\\ WorndNet \\ index.adj",因为该文件正在被另一个进程使用
请帮我Thanx

one of my outlook addin i develop a form (main form) to load at manu button click event and that main form is using stremreader to access some source files

but when main form is close and try to open again using outlook manu button it giving error msg that
Error The process cannot access the file "C:\\WorndNet\\index.adj" because it is being used by another process
pls help me Thanx

推荐答案

最佳猜想:您不要关闭并处理FileStream对象.

如果您打开文件,并且不关闭并处理它,则该文件将保持打开状态,直到垃圾收集器出现并决定需要该空间为止.届时文件将被关闭,对象将被处置.在此之前,所有其他访问文件的尝试都将失败.
Best guess: you do not close and dispose your FileStream objects.

If you open a file, and do not close and dispose it, then it remains open until the garbage collector comes along and decides it needs the space. At that point the file will be closed, and the object disposed. Until then, all other attempts to access the file will fail.


这篇关于流读取器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆