Create a file and get its creation time, full name and Attributes : File Create « File Directory Stream « C# / CSharp Tutorial






using System;
using System.IO;

public class MainClass
{
    public static int Main(string[] args)
    {      
    FileInfo f = new FileInfo(@"C:\Test.txt");
    FileStream fs = f.Create();

    Console.WriteLine("Creation: {0}", f.CreationTime);
    Console.WriteLine("Full name: {0}", f.FullName);
    Console.WriteLine("Full atts: {0}", f.Attributes.ToString());

    fs.Close();
    f.Delete();      

        return 0;
    }
}








15.2.File Create
15.2.1.Creating Files
15.2.2.Create a file and get its creation time, full name and Attributes
15.2.3.Create text file using File.CreateText