C# FileInfo LastAccessTime

Description

FileInfo LastAccessTime Gets or sets the time the current file or directory was last accessed.

Syntax

FileInfo.LastAccessTime has the following syntax.


public DateTime LastAccessTime { get; set; }

Example

Gets the time the current file or directory was last accessed.


using System;/*  w  ww .  ja va  2  s . c  om*/
using System.IO;

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

        Console.WriteLine(fi.LastAccessTime);
    }
}

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