Aşağıdaki kod ile dosya isimleri elde ediliyor
Â
// Get an array of file names as strings rather than FileInfo objects.
// Use this method when storage space is an issue, and when you might
// hold on to the file name reference for a while before you try to access
// the file.
string[] files = System.IO.Directory.GetFiles(currentDirName, "*.txt");
foreach (string s in files)
{
// Create the FileInfo object only when needed to ensure
// the information is as current as possible.
System.IO.FileInfo fi = null;
try
{
fi = new System.IO.FileInfo(s);
}
catch (System.IO.FileNotFoundException e)
{
// To inform the user and continue is
// sufficient for this demonstration.
// Your application may require different behavior.
Console.WriteLine(e.Message);
continue;
}
Console.WriteLine("{0} : {1}",fi.Name, fi.Directory);
}
| < Önceki |
|---|
Newer news items:
- 23/04/2010 07:42 - C kodu içerisinden Assembly çağırımı
- 03/04/2010 19:10 - Web Based Document Oriented Database
- 29/03/2010 08:11 - 2009 Yaz Stajı - Mecidiyeköy-Istanbul
- 28/03/2010 19:02 - Processes and Threads (Grid Computing Simulation)
- 10/12/2009 10:18 - Bil341_0910_Rekürsif Dolasiım













Yorumlar
RSS beslemesi, bu iletideki yorumlar için.