场景
VS2017中运行第一个C#控制台应用并输出HelloWorld:
https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/99131773
实现
string str = "霸道流氓气质";
System.IO.File.WriteAllText(@"C:\Users\Administrator\Desktop\11.txt",str);
Console.WriteLine("写入成功");
Console.ReadKey();
运行效果