如何从嵌入的文本文件中选择随机行?
当我运行程序时它崩溃并给我这个错误(路径中的非法字符)在这一行( String[] randFirst = File.ReadAllLines(Separis_Fantasy_Tools_PE.Properties.Resources.fnames); )
这就是我所拥有的。
private void btnRandom_Click(object sender, EventArgs e)
{
String nFirstName;
String nLastName;
Random fname = new Random();
Random lname = new Random();
String[] randFirst = File.ReadAllLines(Separis_Fantasy_Tools_PE.Properties.Resources.fnames);
nFirstName = randFirst[fname.Next(randFirst.Length)];
String[] randLast = File.ReadAllLines(Separis_Fantasy_Tools_PE.Properties.Resources.lnames);
nLastName = randLast[lname.Next(randLast.Length)];
txtCharacterName.Text = nFirstName + " " + nLastName;
return;
}