About 1,020,000 results
Open links in new tab
  1. Remove duplicates from a List<T> in C# - Stack Overflow

    Sep 7, 2008 · The outer loop makes sure the entire list is processed, the inner loop finds the actual duplicates, those can only happen in the part that the outer loop hasn't processed yet.

  2. How to Use LINQ to Find Duplicates in a List in C#

    Dec 9, 2024 · Finding duplicates in a list using LINQ is straightforward and powerful. With methods like GroupBy, Where, and Select, you can detect duplicates, filter unique elements, …

  3. C# - List Duplicates Example (Remove Duplicates) - Dot Net Perls

    Aug 27, 2025 · Step 1 A List with seven int elements is created. The List contains duplicate elements for the values 3 and 4. Step 2 We use the Distinct() extension method on the List. …

  4. How to remove duplicates from a list in C# - Educative

    These methods are easy to apply and can be used to eliminate duplicates from a list successfully. However, it is important to understand the distinctions between the approaches and identify …

  5. How to Find Duplicates in a List in C# - Delft Stack

    Feb 2, 2024 · Identifying duplicate entries within a list is a common task in C# programming. In this article, we will explore various methods to achieve this, showcasing different approaches …

  6. How to Remove Duplicates from a List with LINQ in C#

    Jan 10, 2025 · In this case, GroupBy(s => s.Title) groups the list by the Title property. Then, Select(s => s.First()) selects the first element from each group, effectively removing duplicates. …

  7. How to Remove Duplicates from a List in C# Efficiently

    Mar 12, 2025 · Learn efficient techniques to eliminate duplicate elements from lists in C#, including LINQ methods, HashSet, and custom approaches that optimize performance and …

  8. linq - C# Determine if List Has Duplicate - Stack Overflow

    An easy way to find duplicates is to write a query that groups by the identifier, and then filter for groups that have more than one member. In the following example, we want to know that 4 …

  9. How to remove the duplicate from list of list? - Microsoft Q&A

    May 18, 2023 · var list1 = Rows_list.Distinct(new ListEqualityComparer<string>()).ToList(); After that, if you want to remove duplicate values in each row, use the following code:

  10. C# – Remove duplicates from a list - makolyte

    May 22, 2023 · The simplest (and most efficient) way to remove duplicates from a list is by iterating, keeping track of items you’ve seen with a HashSet, and discarding items you’ve …