Monday, February 8, 2010

Input/Output (I/O)

File System Class

this file system class are inside the system.IO namespace. it use to manipulate and navigate file, directories and drivers. those class can be categorized in to two type of class file system info and utility.
C# code for get file system information
FileInfo fl = new FileInfo("C:/setup.log");
if (fl.Exists)
{
Console.WriteLine("file Name " + fl.FullName);
}

Enumerate file in directory
DirectoryInfo df = new DirectoryInfo("C:/");
foreach( FileInfo file in df.GetFiles())
{
Console.WriteLine("file Name " + file.FullName);
}
fleSystemwatcher class is used to monitoring file system in the specific path,and can be register event and monitor file changes information.

No comments:

Post a Comment