You may use the
StreamWriter
class, see the sample code in the documentation page [
^].
You may also leave the application as it stands and redirect the output on calling the executable.
For instance, suppose your application's name is
mycomp.exe
, then issuing
mycomp.exe > result.txt
will redirect the output of your program to the
result.txt
text file.
:)