C#獲取指定目錄最后寫入時(shí)間的方法
更新時(shí)間:2015年04月08日 09:35:24 作者:heishui
這篇文章主要介紹了C#獲取指定目錄最后寫入時(shí)間的方法,涉及C#中LastWriteTime屬性的使用技巧,非常具有實(shí)用價(jià)值,需要的朋友可以參考下
本文實(shí)例講述了C#獲取指定目錄最后寫入時(shí)間的方法。分享給大家供大家參考。具體如下:
C#返回指定目錄最后寫入時(shí)間,主要用到了DirectoryInfo的LastWriteTime屬性
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 updated: "); Console.WriteLine(dir.LastWriteTime.ToString()); } Console.WriteLine(); } }
希望本文所述對大家的C#程序設(shè)計(jì)有所幫助。
相關(guān)文章
基于WPF繪制一個(gè)點(diǎn)贊大拇指動(dòng)畫
這篇文章主要為大家詳細(xì)介紹了WPF實(shí)現(xiàn)繪制一個(gè)點(diǎn)贊大拇指動(dòng)畫,文中的示例代碼講解詳細(xì),對我們學(xué)習(xí)或工作有一定幫助,感興趣的小伙伴可以了解一下2023-02-02C#實(shí)現(xiàn)將像素轉(zhuǎn)換為頁面單位的方法
這篇文章主要介紹了C#實(shí)現(xiàn)將像素轉(zhuǎn)換為頁面單位的方法,涉及C#像素轉(zhuǎn)換在圖形繪制中的技巧,需要的朋友可以參考下2015-06-06C#實(shí)現(xiàn)判斷字符串中是否包含中文的方法
這篇文章主要介紹了C#實(shí)現(xiàn)判斷字符串中是否包含中文的方法,非常實(shí)用的功能,需要的朋友可以參考下2014-08-08