I have a .csv file (words.csv) containing 5000 words seperated by commas. Most of the strings are repeated values.
Can I use LINQ to do the following:
A. group common words together and show count of repeated words
so if apple has been repeated 5 times and banana 3 times..it should display as
apple – 5
banana – 3
and so on
B. Create another text file with duplicates removed.
Best Answer
Sure, here's the LINQ syntax in C#:
Or in "pure" C# method calls:
And to create a distinct list of words you just use the Distinct operator: