我正在使用C#,WPF并且有一个关于游戏多项选择的作业,它有一个应用程序,为用户提供列表问题和答案.我想在file.text中写一次不仅一次.
我用过这个事件:

这段代码:
private void Button_Click(object sender, RoutedEventArgs e)
{
using( StreamWriter File = new StreamWriter(@"C:\Users\Admin\Documents\Visual Studio 2013\Projects\?? ÁN 2\?? ÁN 2\bin\Debug\Bo1.txt"))
{
File.WriteLine("dsCauHoi*Câu h?i thêm*"+ txbcauhoi.Text.ToString()+ "*"+txbA.Text.ToString()+ "*"+ txbB.Text.ToString()+ "*" +txbC.Text.ToString() +"*"+ txbD.Text+ "*"+ txbAD.Text.ToString()+"/n");
}
MessageBox.Show("C?m ?n b?n ?ã ?óng góp ý ki?n");
this.Close();
}
Run Code Online (Sandbox Code Playgroud)
但它允许写一次.
我的输入文件包含以下内容:
1.1 CORE VT MODEL
.model ABC
model selector
Run Code Online (Sandbox Code Playgroud)
我用这段代码来捕获".model"字符串
if ($array=~ "\.model")
Run Code Online (Sandbox Code Playgroud)
但我的输出文件在我的输入文件中捕获所有"模型"字符串.那么如何在输入文件中捕获".model"字符串?非常感谢