Click here to Skip to main content
15,891,033 members
Home / Discussions / C#
   

C#

 
AnswerRe: How do I load a block on a form at startup Pin
Luc Pattyn23-Aug-20 2:49
sitebuilderLuc Pattyn23-Aug-20 2:49 
AnswerRe: How do I load a block on a form at startup Pin
Gerry Schmitz23-Aug-20 6:48
mveGerry Schmitz23-Aug-20 6:48 
GeneralRe: How do I load a block on a form at startup Pin
Brian_TheLion24-Aug-20 17:03
Brian_TheLion24-Aug-20 17:03 
QuestionCreating a Windows form program using C# 8.0 Pin
Brian_TheLion22-Aug-20 20:30
Brian_TheLion22-Aug-20 20:30 
SuggestionRe: Creating a Windows form program using C# 8.0 Pin
Richard MacCutchan22-Aug-20 21:05
mveRichard MacCutchan22-Aug-20 21:05 
GeneralRe: Creating a Windows form program using C# 8.0 Pin
Brian_TheLion23-Aug-20 0:34
Brian_TheLion23-Aug-20 0:34 
GeneralRe: Creating a Windows form program using C# 8.0 Pin
Richard MacCutchan23-Aug-20 2:00
mveRichard MacCutchan23-Aug-20 2:00 
GeneralRe: Creating a Windows form program using C# 8.0 Pin
Dave Kreskowiak23-Aug-20 4:07
mveDave Kreskowiak23-Aug-20 4:07 
GeneralRe: Creating a Windows form program using C# 8.0 Pin
Brian_TheLion23-Aug-20 14:30
Brian_TheLion23-Aug-20 14:30 
GeneralRe: Creating a Windows form program using C# 8.0 Pin
Dave Kreskowiak23-Aug-20 18:38
mveDave Kreskowiak23-Aug-20 18:38 
GeneralRe: Creating a Windows form program using C# 8.0 Pin
Brian_TheLion24-Aug-20 16:55
Brian_TheLion24-Aug-20 16:55 
AnswerRe: Creating a Windows form program using C# 8.0 Pin
Mycroft Holmes23-Aug-20 12:22
professionalMycroft Holmes23-Aug-20 12:22 
GeneralRe: Creating a Windows form program using C# 8.0 Pin
Brian_TheLion24-Aug-20 16:57
Brian_TheLion24-Aug-20 16:57 
AnswerRe: Creating a Windows form program using C# 8.0 Pin
Richard Deeming23-Aug-20 23:11
mveRichard Deeming23-Aug-20 23:11 
GeneralRe: Creating a Windows form program using C# 8.0 Pin
Brian_TheLion24-Aug-20 17:01
Brian_TheLion24-Aug-20 17:01 
Question{Solved} Find and count duplicates in a list Pin
Acuena20-Aug-20 2:51
Acuena20-Aug-20 2:51 
AnswerRe: Find and count duplicates in a list Pin
OriginalGriff20-Aug-20 3:38
mveOriginalGriff20-Aug-20 3:38 
GeneralRe: Find and count duplicates in a list Pin
Acuena24-Aug-20 4:16
Acuena24-Aug-20 4:16 
GeneralRe: Find and count duplicates in a list Pin
OriginalGriff24-Aug-20 4:24
mveOriginalGriff24-Aug-20 4:24 
GeneralRe: Find and count duplicates in a list Pin
Acuena24-Aug-20 5:07
Acuena24-Aug-20 5:07 
GeneralRe: Find and count duplicates in a list Pin
OriginalGriff24-Aug-20 5:39
mveOriginalGriff24-Aug-20 5:39 
GeneralRe: Find and count duplicates in a list Pin
Acuena25-Aug-20 4:13
Acuena25-Aug-20 4:13 
GeneralRe: Find and count duplicates in a list Pin
OriginalGriff25-Aug-20 4:43
mveOriginalGriff25-Aug-20 4:43 
AnswerRe: Find and count duplicates in a list Pin
Afzaal Ahmad Zeeshan20-Aug-20 4:37
professionalAfzaal Ahmad Zeeshan20-Aug-20 4:37 
Quote:
I was thinking on using one loop to go threw the list, and then use the second loop to check for duplicates and count.
You are right, it is not just about finding/removing the duplicates, but also counting them.

For a custom solution, you can scan the list and create a Dictionary<string, int> that holds the times that a key occurs; check if the key exists, then increment the value, otherwise, add the key with 1 as value. The algorithm will run O(N) in a single go, and you can then traverse on the Dictionary while performing your actions—and this part depends on how you use the Dictionary and what purpose you make it serve. You will be using a single loop, and the front-end framework (ListView) would then be able to render the results itself; which will again be a loop.

You might as well want to use LINQ or other "shiny" C# features to perform this as well, C# LINQ find duplicates in List - Stack Overflow
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~

AnswerRe: Find and count duplicates in a list Pin
BillWoodruff22-Aug-20 21:58
professionalBillWoodruff22-Aug-20 21:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.