FileSystemInfo.LastAccessTimeUtc 属性
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置上次访问当前文件或目录的时间,其格式为协调世界时 (UTC)。
public:
property DateTime LastAccessTimeUtc { DateTime get(); void set(DateTime value); };
C#
public DateTime LastAccessTimeUtc { get; set; }
C#
[System.Runtime.InteropServices.ComVisible(false)]
public DateTime LastAccessTimeUtc { get; set; }
member this.LastAccessTimeUtc : DateTime with get, set
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.LastAccessTimeUtc : DateTime with get, set
Public Property LastAccessTimeUtc As DateTime
上次访问当前文件或目录的 UTC 时间。
- 属性
Refresh() 不能初始化数据。
当前操作系统不是 Windows NT 或更高版本。
调用方试图设置无效的访问时间。
备注
此方法可能返回不准确的值,因为它使用本机函数,其值可能不会由操作系统持续更新。
如果对象的当前实例FileSystemInfo是从以下DirectoryInfo任一方法返回的,则会预先缓存 属性的值LastAccessTimeUtc:
若要获取最新值,请调用 Refresh 方法。
如果 对象中描述的 FileSystemInfo 文件不存在,则此属性返回 1601 年 1 月 1 日午夜 12:00, (C.E.) 协调世界时 (UTC) 。
有关常见 I/O 任务的列表,请参阅 常见 I/O 任务。
产品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.3, 1.4, 1.6, 2.0, 2.1 |
UWP | 10.0 |