Microsoft .NET documentation - DriveInfo.AvailableFreeSpace Property
You better use using System.IO namespace
using System.IO;
Inside main
DriveInfo[] allDrives = DriveInfo.GetDrives();
// get the correct hard drive
for(int i = 0; i < allDrives.Length; i++)
{
if (allDrives[i].Name == "C:\\")
{
if (ConvertBytesToMegabytes(allDrives[i].TotalFreeSpace) == 750)
{
Console.WriteLine("Success");
} else
{
Console.WriteLine("Error");
}
}
}
The implementation of ConvertBytesToMegabytes
static double ConvertBytesToMegabytes(long bytes)
{
return (bytes / 1024f) / 1024f;
}