C# program to showcases the way to use the FileInfo class

Category > CSHARP || Published on : Thursday, October 1, 2020 || Views: 851 || fileinfo class c#


Here Pawan Kumar will explain how to use the FileInfo class

FileInfo class C# Source Code

using System;
using System.IO;
namespace Demo
{
    class Program
    {
        // The main function
        static void Main(string[] args)
        {
            FileInfo fi = new FileInfo(@"D:\test.html");
            Console.WriteLine("Does the file exist " + fi.Exists);
            Console.WriteLine("The creation time of the file is "
            + fi.CreationTime);
            Console.WriteLine("The size of the file is " + fi.Length);
            Console.Read();
        }
    }
}