public void Printnumber() { Writetext wrtt = new Writetext(); using (StreamWriter sw = new StreamWriter(@"F:\vs\github\WordCount\Astone1213\output.txt", true)) using (StreamReader sr = new StreamReader(txt, true)) { string text1 = sr.ReadToEnd(); text1 = text1.ToLower(); Dictionary <string, int> frequencies = wrtt.Writeword(text1); foreach (KeyValuePair <string, int> entry2 in frequencies) { Console.WriteLine(entry2.Key + " : " + entry2.Value); } } }
public void PrintCipin() { Writetext wrtt = new Writetext(); using (StreamWriter sw = new StreamWriter(@"F:\vs\github\WordCount\Astone1213\output.txt", true)) using (StreamReader sr = new StreamReader(str, true)) { string text = sr.ReadToEnd(); text = text.ToLower(); Dictionary <string, int> frequencies = wrtt.Writeword(text); var dic = from objDic in frequencies orderby objDic.Value descending select objDic; foreach (KeyValuePair <string, int> entry in dic.Take(10)) { Console.WriteLine(entry.Key + " : " + entry.Value); sw.WriteLine(entry.Key + " : " + entry.Value); } } }