FileSystemInfo.LastAccessTime プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > FileSystemInfo.LastAccessTime プロパティの意味・解説 

FileSystemInfo.LastAccessTime プロパティ

現在のファイルまたはディレクトリ最後にアクセスした時刻取得または設定します

名前空間: System.IO
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Dim instance As FileSystemInfo
Dim value As DateTime

value = instance.LastAccessTime

instance.LastAccessTime = value
public DateTime LastAccessTime { get; set;
 }
/** @property */
public DateTime get_LastAccessTime ()

/** @property */
public void set_LastAccessTime (DateTime value)
public function get LastAccessTime
 () : DateTime

public function set LastAccessTime
 (value : DateTime)

プロパティ
現在のファイルまたはディレクトリ最後にアクセスした時刻

例外例外
例外種類条件

IOException

Refreshデータ初期化できません。

PlatformNotSupportedException

現在のオペレーティング システムMicrosoft Windows NT 以降ではありません。

解説解説
使用例使用例

"タッチ" 操作使用した LastAccessTime プロパティ更新方法次のコード例示します。この例では、ファイルが "タッチ" され、CreationTime、LastAccessTime、および LastWriteTime の各プロパティ現在の日時更新されます。

Imports System
Imports System.IO

Public Class Touch
    Public Shared Sub Main(ByVal
 args() As String)

        ' Make sure an argument (filename) was provided.
        If args.Length > 0 Then

            ' Verify that the provided filename exists.
            If File.Exists(args(0)) Then
                Dim fi As FileInfo = New
 FileInfo(args(0))
                touchFile(fi)
            Else
                Console.WriteLine("Could not find the file {0}",
 args(0))
            End If
        Else
            Console.WriteLine("No file specified.")
        End If
    End Sub

    Public Shared Sub touchFile(ByVal
 fsi As FileSystemInfo)
        Console.WriteLine("Touching: {0}", fsi.FullName)

        ' Update the CreationTime, LastWriteTime and LastAccessTime.
        Try
            fsi.CreationTime = DateTime.Now
            fsi.LastAccessTime = DateTime.Now
            fsi.LastWriteTime = DateTime.Now
        Catch e As Exception
            Console.WriteLine("Error: {0}", e.Message)
        End Try

    End Sub

End Class
using System;
using System.IO;

namespace touch
{
    class Touch
    {
        static void Main(string[]
 args)
        {
            // Make sure a filename was provided.
            if (args.Length > 0)
            {
                // Verify that the provided filename exists.
                if (File.Exists(args[0]))
                {
                    FileInfo fi = new FileInfo(args[0]);
                    touchFile(fi);
                }
                else
                {
                    Console.WriteLine(
                        "Could not find the file: {0}.", args[0]);
                }
            }
            else
            {
                Console.WriteLine("No file was specified.");
            }
        }

        static void touchFile(FileSystemInfo
 fsi)
        {
            Console.WriteLine("Touching: {0}", fsi.FullName);

            // Update the CreationTime, LastWriteTime and LastAccessTime.
            try
            {
                fsi.CreationTime = fsi.LastWriteTime = fsi.LastAccessTime =
                    DateTime.Now;
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: {0}", e.Message);
            }
        }
    }
}
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からFileSystemInfo.LastAccessTime プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からFileSystemInfo.LastAccessTime プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からFileSystemInfo.LastAccessTime プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

FileSystemInfo.LastAccessTime プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



FileSystemInfo.LastAccessTime プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS