I have some code that removes duplicate lines from a text file, it then outputs the result (text with no duplicates) to a file. How could I also declare this output as a string as well?
private static void RemoveDuplicate(string sourceFilePath, string destinationFilePath)
{
var readLines = File.ReadAllLines(sourceFilePath, Encoding.Default);
File.WriteAllLines(destinationFilePath, readLines.Distinct().ToArray(), Encoding.Default);
}