Saturday, 2 December 2017

C# Program to View the Date and time of Access of a File


Code:

using System;
using System.IO;
class Program
{
    static void Main()
    {
        FileInfo info = new FileInfo("C:\\sri\\srip.txt");
        DateTime time = info.CreationTime;
        Console.WriteLine("File Creation Time     : {0}", time);
        time = info.LastAccessTime;
        Console.WriteLine("File Last Access Time  : {0}", time);
        time = info.LastWriteTime;
        Console.WriteLine("File Last Write Time   : {0} ", time);
        Console.Read();
    }
}


Output:

File Creation Time   : 8/11/2013 7:17:20 PM
File Access Time     : 8/15/2013 1:08:45 PM
File Last Write Time : 8/15/2013 1:37:36 PM

More C# Programs:


















100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...