I'm making a console application that reads from a text file, stores its contents into an array and then randomly chooses a name to win.
I need to have it read names from a .txt file line by line using streamreader and store the names into an array. I also need to check if the file doesn't exists. if it doesn't it needs to create a new .txt file and write the names that the user enters into the file.
I know how to read a file line by line but I don't know how to store each line into an array. I also know how to enter names and store it into an array but I don't know how to make a text file from an array.
If it doesn't make sense I can try explain it more.
Finally this is how it needs to be set out:
if (File.Exists(PATH))
I need to have it read names from a .txt file line by line using streamreader and store the names into an array. I also need to check if the file doesn't exists. if it doesn't it needs to create a new .txt file and write the names that the user enters into the file.
I know how to read a file line by line but I don't know how to store each line into an array. I also know how to enter names and store it into an array but I don't know how to make a text file from an array.
If it doesn't make sense I can try explain it more.
Finally this is how it needs to be set out:
if (File.Exists(PATH))
{
else
}{
}
GoldBl4d3