Writing to txt file reach out of memory ? C# [closed]

According to new question, here is the answer:

StreamWriter outputFileTwoo = new StreamWriter(resultatsTwoo);
List <string> firstListThatIcantRevealItName= new List<string>();
List <string> secondListThatIcantRevealItName= new List<string>();
firstListThatIcantRevealItName=System.IO.File.ReadAllLines(@"C:\Users\me\Desktop\blabla.txt").ToList();
secondListThatIcantRevealItName=System.IO.File.ReadAllLines(@"C:\Users\me\Desktop\potto.txt").ToList();

using(StreamWriter outputFileOne = new StreamWriter(resultatsOne))
{
  foreach (string trade in secondListThatIcantRevealItName)
  {
    endofFile++;
    if (!secondListThatIcantRevealItName.Contains(trade))
    {
      outputFileOne.WriteLine("Trade number : " + trade + " exist in first list  but not in second list ");
    }
    if(endofFile==i)
    {
      outputFileOne.WriteLine(endofFile);
    }
  }
}

Leave a Comment