我有用于存储禁止域列表的文本文件,该列表也显示在表格的页面上,但是即使插入了换行符,它仍然作为单个字符串写入一行。如果有人对为什么这样做有任何想法,将不胜感激!
private void GetNote()
{
string[] lines = File.ReadAllLines(MapPath(FILE_PATH));
bannedDomains.InnerText = string.Join("\r\n", lines);
//bannedDomains.InnerText = File.ReadAllText(MapPath(FILE_PATH));
}
private void SaveNote()
{
File.AppendAllText(MapPath(FILE_PATH), "\r\n" + bannedDomainText.Text);
//using (TextWriter tw = new StreamWriter(MapPath(FILE_PATH)))
//{
// tw.WriteLine(bannedDomainText.Text);
//}
}