Created
June 23, 2020 12:29
-
-
Save luisdeol/b9e759eb6b86b1d880ee3f53a6d0e753 to your computer and use it in GitHub Desktop.
4.1: Creating, Retrieving information and deleting a file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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