First, you should wrap the
StreamWriter
in a using as below and you might try adding a
Flush
statement (though not strictly required).
using (StreamWriter str = new StreamWriter(path))
{
str.Flush();
}
Does your process create an empty file or no file at all?
Also, don't see where array is declared: perhaps it should be as:
str.WriteLine(array.ToString());
In any case, consider using a StringBuilder to gather the data together: easier to format and can be used directly.
Try reading through this:
StreamWriter Class[
^]