"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Monday, June 21, 2010

7 New methods to Enumerate Directory and Files in .NET 4.0

.NET 4.0 introduces 7 new methods to Enumerate directories and files. All these methods return Enumerable Collections (IEnumerable<T>), which perform better than arrays.

Here are the 7 new methods:

Directory.EnumerateDirectories - Returns an enumerable collection of directory names in a specified path

DirectoryInfo.EnumerateDirectories - Returns an enumerable collection of directory information in the current directory

Directory.EnumerateFiles - Returns an enumerable collection of file names in a specified path

DirectoryInfo.EnumerateFiles - Returns an enumerable collection of file information in the current directory

Directory.EnumerateFileSystemEntries - Returns an enumerable collection of file-system entries in a specified path

DirectoryInfo.EnumerateFileSystemInfos - Returns an enumerable collection of file system information in the current directory

File.ReadLines - Reads the lines of a file

Illustrated C# 2008 (Windows.Net)Microsoft Visual C# 2010 Step by StepHead First C#


Have a nice day... 'N happy Coding :)

No comments: