txt dosyasındaki satır sayısını ekrana yazma — C# Console

txt dosyasındaki satır sayısını ekrana yazma — C# Console

[code lang=”csharp”]

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;//www.gorselprogramlama.com

using System.IO;

namespace ConsoleApplication12

{

class Program

{

static void Main(string[] args)

{

StreamReader st = new StreamReader(@"C:\gorsel.txt");

int i = 0;

while (st.Read() > 0)//www.gorselprogramlama.com

{

st.ReadLine();

i++;

}

Console.WriteLine("gorsel txt doyasındaki satır Sayısı = " + i);

Console.ReadLine(); //www.gorselprogramlama.com

}

}

}

[/code]

Projeyi İNDİR

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir