Как перейти на следующую строку с классом File? - C#
Формулировка задачи:
Господа, как сделать так, чтобы вместо нижних подчёркиваний цифры начинались с новой строки?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
int n = Convert.ToInt32(textBox1.Text);
int[] x = new int[n * ((n * n + n))];
int ix = 0;
int y = 0;
int rm;
Random rnd = new Random();
for (int i = 0; i <= x.GetUpperBound(0); i++)
//GetUpperBound(0) получает индекс последнего элемента в массиве
{
rm = rnd.Next(1, 9);
x[ix] = rm;
File.AppendAllText(@"C:\qq.txt", Convert.ToString(x[ix]));
ix++;
if ( i == (n * n + n) / 2)
{
File.AppendAllText(@"C:\qq.txt", "_________");
i = 0;
y++;
if (y == n)
{
Application.Exit();
}
}
}
}
}
}Решение задачи: «Как перейти на следующую строку с классом File?»
textual
Листинг программы
File.AppendAllText(@"c:\qq.txt", Environment.NewLine);