Windows Dev Center

The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

FileSystemInfo.LastAccessTime Property

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

[Visual Basic]
Public Property LastAccessTime As DateTime
public DateTime LastAccessTime {get; set;}
public: __property DateTime get_LastAccessTime();
public: __property void set_LastAccessTime(DateTime);
public function get LastAccessTime() : DateTime;
public function set LastAccessTime(DateTime);

Property Value

The time that the current file or directory was last accessed.


Exception Type Condition
IOException Refresh cannot initialize the data.


When first called, FileSystemInfo calls Refresh and returns the cached information on APIs to get attributes and so on. On subsequent calls, you must call Refresh to get the latest copy of the information.

This property value is a null reference (Nothing in Visual Basic) if the file system containing the file does not support this information.

The following table lists examples of other typical or related I/O tasks.

To do this... See the example in this topic...
Write to a text file. Writing Text to a File
Read from a text file. Reading Text from a File
Append text to a file. Opening and Appending to a Log File



Rename or move a file. File.Move


Get the attributes of a file. File.GetAttributes
Set the attributes of a file. File.SetAttributes

Windows 95, Windows 98, Windows 98 Second Edition Platform Note:  These operating systems do not support this property, and DirectoryInfo implementations of this property are not supported.

.NET Compact Framework Platform Note:  The LastAccessTime property is read-only.


Platforms: .NET Compact Framework

.NET Framework Security: 

See Also

FileSystemInfo Class | FileSystemInfo Members | System.IO Namespace | Working with I/O | Reading Text from a File | Writing Text to a File

© 2015 Microsoft