简体   繁体   English

使用 Linq 创建日志文件到 Xml

[英]Create Log File Using Linq To Xml

I need to create application log file using Linq-To-Xml.我需要使用 Linq-To-Xml 创建应用程序日志文件。 I would like to lock the file from user editing, but keep the application to update the file (radonly privilege).我想锁定用户编辑文件,但让应用程序更新文件(radonly 权限)。

Is there a way to do so using Linq-To-Xml functionalities (I'm currently uses FileInfo)?有没有办法使用 Linq-To-Xml 功能(我目前使用 FileInfo)?

(The framework is.Net 3.5) (框架是.Net 3.5)

Cheers干杯

Your question is a little confusing.你的问题有点令人困惑。 Linq-To-Xml and FileInfo don't really have a huge amount to do with each other. Linq-To-Xml 和 FileInfo 之间并没有太大的关系。 I am guessing you are using the FileInfo class to save you linq-To-Xml document to disk.我猜您正在使用 FileInfo class 将您的 linq-To-Xml 文档保存到磁盘。 Have a look at the FileStream class.看看 FileStream class。 There are a number of overloads on the FileStream class that allow you to control access to the file you are writing to. FileStream class 上有许多重载,允许您控制对正在写入的文件的访问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM