How to write string array to text file in C#

1 Answer

0 votes
using System;
using System.IO;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] words = new string[6] { "stripos", "click", "substr", "save", "search", "sizeof" };

            File.WriteAllLines("d:\\file.txt", words);
        }
    }
}

/*
run:
   
file.txt:
--------
stripos
click
substr
save
search
sizeof
 
*/


answered Mar 11, 2015 by avibootz

Related questions

3 answers 238 views
238 views asked Mar 11, 2015 by avibootz
2 answers 276 views
1 answer 206 views
1 answer 198 views
1 answer 175 views
1 answer 228 views
228 views asked Mar 17, 2015 by avibootz
...