我想在目标文件夹中创建 100 个文件,下面是源代码,但是它在目标文件夹中创建文件。感谢任何帮助
class Program
{
static void Main(string[] args)
{
int i=1;
string path = @"E:\Project\C_Sharp\Tutorial\Console_App\FileSystem\Output\";
if (!File.Exists(path))
{
for (i = 1; i < 100; i++)
{
string FileName = "MyTest" + i + ".txt";
path = FileName;
// Create a file to write to.
using (StreamWriter sw = File.CreateText(path))
{
sw.WriteLine("Hello");
sw.WriteLine("And");
sw.WriteLine("Welcome");
}
}
}
}
}