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();
}
}
希望本文所述對大家的C#程序設(shè)計(jì)有所幫助。
相關(guān)文章
C#使用DeflateStream解壓縮數(shù)據(jù)文件的方法
這篇文章主要介紹了C#使用DeflateStream解壓縮數(shù)據(jù)文件的方法,較為詳細(xì)的分析了DeflateStream方法對文件進(jìn)行壓縮及解壓縮的步驟與技巧,需要的朋友可以參考下2015-04-04
C#實(shí)現(xiàn)對文件進(jìn)行加密解密的方法
這篇文章主要介紹了C#實(shí)現(xiàn)對文件進(jìn)行加密解密的方法,涉及C#加密與解密的技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-04-04
c# 將Datatable數(shù)據(jù)導(dǎo)出到Excel表格中
本文主要介紹了c# 將Datatable數(shù)據(jù)導(dǎo)出到Excel表格中的方法。具有很好的參考價(jià)值。下面跟著小編一起來看下吧2017-03-03
Dictionary擴(kuò)展基礎(chǔ)類向字典中添加鍵和值
Dictionary<TKey, TValue> 類是常用的一個(gè)基礎(chǔ)類,但用起來有時(shí)確不是很方便。本文逐一討論,并使用擴(kuò)展方法解決2013-11-11

