With the code below, the command prompt disappears almost immediately after appearing. Shouldn’t this code display all the removable drives being used?
using System.Linq;
using System.IO;
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var drives = DriveInfo.GetDrives()
.Where(drive => drive.IsReady && drive.DriveType == DriveType.Removable);
Console.WriteLine("Removable drives being used:", drives);
}
}
}
Many thanks in advance!
Try this…