diff --git a/HomeworksDircAndFile/Program.cs b/HomeworksDircAndFile/Program.cs index 6fb8f0f..cbd540e 100644 --- a/HomeworksDircAndFile/Program.cs +++ b/HomeworksDircAndFile/Program.cs @@ -4,7 +4,27 @@ internal class Program { static void Main(string[] args) { - Console.WriteLine("Hello, World!"); + Console.Write("Fayl manzilini kiriting" + + "(Misol : D:\\papka nomi\\...\\ fayl nomi.txt) : "); + + string path = Console.ReadLine(); + + TextSearchLine(path); + } + + static void TextSearchLine(string path) + { + + if(File.Exists(path)) + { + Console.WriteLine($" Fayl ichidagi textni qatorlari soni :" + + $" {File.ReadAllLines(path).Length}."); + } + + else + { + Console.WriteLine($"Bunday fayl [ {path} ] mavjud emas."); + } } } } \ No newline at end of file