EnumerateDirectories() – joriy katalogdagi ma'lumotlarni sanaydigan to'plamni qaytaradi.
Foydalanish misoli: using System;
using System.IO;
using System.Linq;
namespace EnumDir
{
class Program
{
static void Main(string[] args)
{
string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
DirectoryInfo dirPrograms = new DirectoryInfo(docPath);
DateTime StartOf2019 = new DateTime(2019, 12, 04);
var dirs = from dir in dirPrograms.EnumerateDirectories()
where dir.CreationTimeUtc > StartOf2019
select new {
ProgDir = dir,
};
Console.WriteLine("(2019, 12, 04) sanadan boshlab yaratilgan kataloglar ro'yxati:"+"\n");
foreach (var di in dirs)
{
Console.WriteLine(di.ProgDir.Name);
}
Console.ReadKey();
}
}
}
Natijasi:
EnumerateDirectories(String) – belgilangan yo’lda qidirish namunasiga mos keladigan katalogning to’liq nomlarini sanaydigan to’plamni qaytaradi.
Foydalanish misoli: Public System.Collections.Generic.IEnumerable EnumerateDirectories (string searchPattern);
EnumerateDirectories(String, SearchOption) – belgilangan yo’lda qidirish namunasiga mos keladigan katalogning to’liq nomlarini sanaydigan to’plamini va ixtiyoriy ravishda qidirilgan pastki kataloglarni qaytaradi.
Foydalanish misoli: public System.Collections.Generic.IEnumerable EnumerateDirectories (string searchPattern, SearchOption searchOption);
MoveTo() – DirectoryInfo nusxasini va uning tarkibini yangi yo'lga ko'chiradi.
Foydalanish misoli: