我正在尝试List<string>
使用该类将 a 写入文件StreamWriter
。当我将参数(在调试模式下)传递给write_lines()
函数时,程序会停止而没有任何错误。也许有人知道我做错了什么
public class Writer
{
private StreamWriter the_writer;
private string PS_filepath;
public Writer()
{
}
public void write_lines(List<string> thelines, string path)
{
this.PS_filepath = path;
this.the_writer = new StreamWriter(PS_filepath, true);
foreach(string line in thelines)
{
the_writer.WriteLine(line);
}
}
}
Path var is C:\path\text.xyz