Hello, i needed help in creating a file not necessarily to be functional, just a name and an extension. Is there an easy way to do that?
thanks
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
AlanPosted Oct 6, 2008, 1:44 PM
Here's a very easy way to create a text file and write some stuff to it (requires .NET 2.0 or later):
using System;
using System.IO;
class Test
{
static void Main()
{
string[] lines = new string[]{"Hello", "world"};
string filePath = "harto.txt";
File.WriteAllLines(filePath, lines);
}
}