I have a 3 projects:
1 - .NET Core app
2 - .NET Framework app
3 - .NET Standard library where is common code for both first and second app projects.
...I want to check my drive free space in .NET Standard library to perform other following operations. Is it possible? How?
DriveInfo is a system dependent InteropServices because the names and attributes of drives are different between Linux and Windows. But it is implemented in both worlds.
using System;
using System.IO;
//...
DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo d in allDrives)
{
Console.WriteLine("Drive {0}", d.Name);
Console.WriteLine(" Free:{0, 15} bytes", d.AvailableFreeSpace);
}