您可以使用TextIo X类或CLRInterop.
这里有2个X作业来演示这两种方法.
原文链接:https://www.f2er.com/windows/364018.html这里有2个X作业来演示这两种方法.
static void Job_TextIO(Args _args) { TextIo textIo; #File ; textIo = new TextIo(@"C:\textIOtest.txt",#IO_WRITE); textIo.write("Line 1\n"); textIo.write("Line 2"); } static void Job_StreamWriter(Args _args) { System.IO.StreamWriter sw; InteropPermission perm = new InteropPermission(InteropKind::ClrInterop); ; perm.assert(); sw = new System.IO.StreamWriter(@"C:\test.txt"); sw.WriteLine("Line 1"); sw.WriteLine("Line 2"); sw.Flush(); sw.Close(); sw.Dispose(); CodeAccessPermission::revertAssert(); }