File.SetLastAccessTimeUtc(String, DateTime) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
设置上次访问指定的文件的日期和时间,其格式为协调通用时 (UTC)。
public:
static void SetLastAccessTimeUtc(System::String ^ path, DateTime lastAccessTimeUtc);
public static void SetLastAccessTimeUtc (string path, DateTime lastAccessTimeUtc);
static member SetLastAccessTimeUtc : string * DateTime -> unit
Public Shared Sub SetLastAccessTimeUtc (path As String, lastAccessTimeUtc As DateTime)
参数
- path
- String
要设置其访问日期和时间信息的文件。
例外
.NET Framework 和 .net Core 版本早于2.1: path
是一个长度为零的字符串,仅包含空格,或包含一个或多个无效字符。 你可以使用 GetInvalidPathChars() 方法查询无效字符。
path
为 null
。
指定的路径和/或文件名超过了系统定义的最大长度。
未找到指定路径。
调用方没有所要求的权限。
path
的格式无效。
lastAccessTimeUtc
指定一个超出该操作允许的日期或时间范围的值。
注解
path
允许参数指定相对或绝对路径信息。 相对路径信息被解释为相对于当前工作目录。 若要获取当前工作目录,请参见 GetCurrentDirectory 。
有关常见 i/o 任务的列表,请参阅 常见 I/o 任务。