0

I've got applicatipon based on c# where i can do some custom scripts and i need to REMOVE DUPLICATES from one list

but

I can't use LINQ (and it's Distinct() method - cause Net Framework of app is < 3.5) cause application doesn't recognize it and also it doesn't recognize HashSet method so am a bit confused with it, any ideas ?

this is list of strings, for example:

List<string> withDuplicates= new List<string>(new string[] { "A", "A", "B", "C", "C"});

  • 1
    You can use a `Dictionary`, but set the value to `null` – canton7 Jan 04 '22 at 10:50
  • Don't forget, [the source code of a HashSet](https://referencesource.microsoft.com/#System.Core/System/Collections/Generic/HashSet.cs) is also available if you want to copy it and roll it into your project, but like the comment in that source code says, a hashset is practically just a dictionary with no values support. If you don't have a Dictionary, .net's had a [Hashtable](https://learn.microsoft.com/en-us/dotnet/api/system.collections.hashtable?view=net-6.0) from birth, I think.. – Caius Jard Jan 04 '22 at 11:16

0 Answers0