I am running a function and when it does it for the first column 0 i want to write those results to a csv file.Then run it for column 1 and save it in the same csv file but in the next column.So . .

Result 1 = csv file column 1
result 2 = same csv file column 2


Any ideas guys???

public void FileAppendToLine(String pathfile, Object[] array) {
    String[] lines = File.ReadAllLines(pathfile);
    if (lines.Length < array.Length) {
        Array.Resize(ref lines, array.Length);
    }

    for (int i = 0; i < array.Length; i++) {pathfile, lines) {
        if (String.IsNullOrEmpty(array[i])) {
            array[i] = lines[i].ToString();
        } else {
            array[i] += "," + lines[i].ToString();
        }
    }
    File.WriteAllLines(pathfile, lines);
}