C#獲取目錄最后訪問時(shí)間的方法
更新時(shí)間:2015年04月08日 09:09:29 作者:heishui
這篇文章主要介紹了C#獲取目錄最后訪問時(shí)間的方法,涉及C#中LastAccessTime方法的使用技巧,需要的朋友可以參考下
本文實(shí)例講述了C#獲取目錄最后訪問時(shí)間的方法。分享給大家供大家參考。具體如下:
using System; using System.IO; class MainClass { static void Main(string[] args) { FileInfo file = new FileInfo("c:\\a.txt"); // Display directory information. DirectoryInfo dir = file.Directory; Console.WriteLine("Checking directory: " + dir.Name); Console.WriteLine("In directory: " + dir.Name); Console.Write("Directory exists: "); Console.WriteLine(dir.Exists.ToString()); if (dir.Exists) { Console.Write("Directory last accessed: "); Console.WriteLine(dir.LastAccessTime.ToString()); } Console.WriteLine(); } }
希望本文所述對(duì)大家的C#程序設(shè)計(jì)有所幫助。
相關(guān)文章
基于C#中IDisposable與IEnumerable、IEnumerator的應(yīng)用
本篇文章小編為大家介紹,基于C#中IDisposable與IEnumerable、IEnumerator的應(yīng)用,需要的朋友參考下2013-04-04C#實(shí)現(xiàn)拷貝文件到另一個(gè)文件夾下
這篇文章主要介紹了C#實(shí)現(xiàn)拷貝文件到另一個(gè)文件夾下,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-01-01解析從源碼分析常見的基于Array的數(shù)據(jù)結(jié)構(gòu)動(dòng)態(tài)擴(kuò)容機(jī)制的詳解
本篇文章是對(duì)從源碼分析常見的基于Array的數(shù)據(jù)結(jié)構(gòu)動(dòng)態(tài)擴(kuò)容機(jī)制進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下2013-05-05C# 使用 Castle 實(shí)現(xiàn) AOP及如何用 Autofac 集成 Castle
這篇文章主要介紹了C# 使用 Castle 實(shí)現(xiàn) AOP及如何用 Autofac 集成 Castle,幫助大家更好的理解和學(xué)習(xí)使用c#,感興趣的朋友可以了解下2021-02-02