set file to ReadOnly state
Published: 9. October 2011 | Updated: 25. October 2011License: Microsoft Public License (MS-PL)
Categories: File system, Windows
Tags: C# File System Windows
Import namespace
using System.IO;
Code
var info = new FileInfo(@"C:\Folder\test.txt"); info.IsReadOnly = true; // or File.SetAttributes(@"C:\Folder\test.txt", FileAttributes.ReadOnly);
| Send us feedback about this snippet » |





