I have a txt document which has over 14000 different lines many of these are duplicates, is it possible to count the number of unique entries?
You can use the File.ReadLines Method and LINQ's Distinct and Count Extension Methods:
var result = File.ReadLines("input.txt").Distinct().Count();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With