C# File SetLastAccessTime

Description

File SetLastAccessTime Sets the date and time the specified file was last accessed.

Syntax

File.SetLastAccessTime has the following syntax.


public static void SetLastAccessTime(
  string path,
  DateTime lastAccessTime
)

Parameters

File.SetLastAccessTime has the following parameters.

  • path - The file for which to set the access date and time information.
  • lastAccessTime - A DateTime containing the value to set for the last access date and time of path. This value is expressed in local time.

Returns

File.SetLastAccessTime method returns

Example

The following example demonstrates SetLastAccessTime.


/*from   ww w . j  a  v  a2  s.  com*/

using System;
using System.IO;

class Test 
{
    public static void Main() 
    {
      string path = @"c:\Temp\MyTest.txt";
      File.SetLastAccessTime(path, new DateTime(2014,4,3));
    }
}




















Home »
  C# Tutorial »
    System.IO »




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