Could someone demonstrate how a file is checked for duplicate lines, and then any duplicates are removed either overwriting the existing file, or create a new file with the duplicate lines removed
Could someone demonstrate how a file is checked for duplicate lines, and then any
Share
If you’re using .NET4 then you could use a combination of
File.ReadLinesandFile.WriteAllLines:This functions in pretty much the same way as LINQ’s
Distinctmethod, with one important difference: the output ofDistinctisn’t guaranteed to be in the same order as the input sequence. Using aHashSet<T>explicitly does provide this guarantee.