开发者

How to check whether an xml file can be accessed or not in c#? [closed]

开发者 https://www.devze.com 2023-01-03 04:05 出处:网络
As it currentl开发者_开发问答y stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely so
As it currentl开发者_开发问答y stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 10 years ago.

I am saving dafault values to a xml file. If I don't have access to the xml file I should show a message in the status bar to the user. How can I do that?


Just try to open it, if you don't have access it will throw a System.UnauthorizedAccessException or if it is in use it will throw a System.IO.IOException, catch these exceptions and display an access denied message to the user.

0

精彩评论

暂无评论...
验证码 换一张
取 消