Skip to content

Instantly share code, notes, and snippets.

@luisdeol
Created June 23, 2020 12:29
Show Gist options
  • Save luisdeol/b9e759eb6b86b1d880ee3f53a6d0e753 to your computer and use it in GitHub Desktop.
Save luisdeol/b9e759eb6b86b1d880ee3f53a6d0e753 to your computer and use it in GitHub Desktop.
4.1: Creating, Retrieving information and deleting a file.
using System;
using System.IO;
namespace ImplementDataAccess._41_PerformIoOperations
{
class Program
{
static void Main(string[] args)
{
var myFile = @"../../Directory/file_5.txt";
if (!File.Exists(myFile))
{
File.CreateText(myFile);
}
var fileInfo = new FileInfo(myFile);
Console.WriteLine($"File name: {fileInfo.FullName}, Size: {fileInfo.Length}, Last Update: {fileInfo.LastWriteTimeUtc}");
File.Delete(myFile);
Console.Read();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment