 <p>Two ways:</p> <pre><code>System.IO.FileInfo fileInfo = new System.IO.FileInfo(filePath); fileInfo.IsReadOnly = true/false; </code></pre> <p>or</p> <pre><code>// Careful! This will clear other file flags e.g. FileAttributes.Hidden File.SetAttributes(filePath, FileAttributes.ReadOnly/FileAttributes.Normal); </code></pre> <p>The IsReadOnly property on FileInfo essentially does the bit-flipping you would have to do manually in the second method.</p>