So we all know that the following code will return a long:
DriveInfo myDrive = new DriveInfo("C:\\");
long size = myDrive.TotalSize;
Console.WriteLine("Drive Size is: {0}", size);
The output will be something like this:
Drive Size is: 114203439104
So I think this means that the drive has a total size of around 114 GigaBytes.
However, I want to get this into the following format:
114.2 MB
Is there a really quick and easy way of doing this?
Thanks in advance.
Copyright Notice:Content Author:「bobble14988」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/7246492/formatting-the-result-of-driveinfos-totalsize-in-c-sharp