C# FileInfo IsReadOnly

Description

FileInfo IsReadOnly Gets or sets a value that determines if the current file is read only.

Syntax

FileInfo.IsReadOnly has the following syntax.


public bool IsReadOnly { get; set; }

Example

The following example uses the IsReadOnly property.


using System;/* w  ww  .  j ava2  s .c o m*/
using System.IO;

public class DirectoryTest 
{
    public static void Main() 
    {
        FileInfo fi = new FileInfo("temp.txt");

        Console.WriteLine(fi.IsReadOnly);
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.IO »




BinaryReader
BinaryWriter
Directory
DirectoryInfo
DriveInfo
File
FileInfo
FileStream
MemoryStream
Path
StreamReader
StreamWriter
StringReader
StringWriter