Two ways to achieve it:
System.IO.FileInfo fileInfo = new System.IO.FileInfo(filePath);
fileInfo.IsReadOnly = true/false;
IsReadOnly property on FileInfo essentially does the bit-flipping you would have to do manually in the second method.
File.SetAttributes(filePath, FileAttributes.ReadOnly/FileAttributes.Normal);