Change file attribute in CSharp
Description
The following code shows how to change file attribute.
Example
/* ww w. j av a2 s. com*/
using System;
using System.IO;
class Class1
{
[STAThread]
static void Main(string[] args)
{
File.SetAttributes( "Main.cs", File.GetAttributes("Main.cs") | FileAttributes.ReadOnly );
File.SetAttributes( "Main.cs", File.GetAttributes("Main.cs") & (~FileAttributes.ReadOnly) );
}
}