Using the below given code snippet, we can open a text file and read the number of given character occurs
Here is the algorithm
Here is the code snippet
private static void ReadNoOfSimilarChar(string word)
{
StreamReader reader = File.OpenText(@"c:\data.txt");
int letterCount = 0;
while (!reader.EndOfStream)
{
string line = reader.ReadLine();
for (int i = 0; i < line.Length; i++)
{
if (line.Substring(i, 1) == word)
{
letterCount++;
}
}
}
Console.Write(letterCount);
Console.Read();
}
Thanks,
Karthik KK
need to know more about the polymorphism programs (virtual and override).Can u give us some idea?