File being used by another process after using File.Create()

    File.Create(FilePath).Close();
    File.WriteAllText(FileText);

I want to update this answer to say that this is not really the most efficient way to write all text. You should only use this code if you need something quick and dirty.

I was a young programmer when I answered this question, and back then I thought I was some kind of genius for coming up with this answer.

Leave a Comment