Calculate the Size of a Folder/Directory using .NET 4.0

added by johnastuntz
7/29/2010 5:59:32 AM

1 Kicks, 97 Views

.NET 4.0 introduces new methods to Enumerate Directory and Files in .NET 4.0. We will be using the DirectoryInfo.EnumerateDirectories and DirectoryInfo.EnumerateFiles in this sample which returns an enumerable collection of Directory and File information respectively to calculate the size of a folder or directory using .NET 4.0 and LINQ.