Writing to file best practises (locked files/overwriting)
<p>If I am working with files in C#, what is the best way to check if a file is locked in C#?</p>

<p>If I use File.OpenWrite(), which returns a FileStream, and this returns CanWrite = false, is this a way of checking so?</p>

<p>Also, what is it wise to write to just one location in my code? So I specify a path to write to like "TestExample.txt", but then if I run my code, successfully write to the file, run again, the same data will be in there. Is it possible to overwrite the data already in a file altogether? Or do I need to manually delete (I know this sounds naive).</p>

<p>Thanks</p>
