If you want to change the state of the files as read only you can use one of the following techniques.
First of all import System.IO namespace
Then either set IsReadOnly property of FileInfo class to true or use SetAttributes function of File class as shown below:
var file = new FileInfo(@"D:\MyFolder\MyFile.txt");
file.IsReadOnly = true;