[MonoTouch] Get Device free disk space
Miguel de Icaza
miguel at xamarin.com
Fri Dec 23 09:41:33 EST 2011
Hello,
string path =
> Environment.GetFolderPath(Environment.SpecialFolder.Personal);
> NSDictionary dictionary =
> NSFileManager.DefaultManager.GetFileSystemAttributes(path);
> NSNumber number =
>
> (NSNumber)dictionary.ObjectForKey(NSObject.FromObject(NSFileManager.SystemFreeSize));
> ulong freeBytes = number.UInt64Value;
>
Ouch. That is so incredibly complicated, use this instead:
var attrs = NSFileManager.DefaultManager.GetFileSystemAttributes(path);
ulong freeBytes = attrs.FreeSize;
Miguel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monotouch/attachments/20111223/2b6bf03f/attachment.html
More information about the MonoTouch
mailing list