EDIT:
Due to random downvotes still coming in I guess I can clarify this some more.
Essentially the question is asking how do you read from a text file in C#. The code i thought would work is below. The answer provides what actually works. Please comment when you downvote.
OLD:
I’m using Microsoft visual studios to write a video game, but can’t seem to get it to take in input from a text file. If i comment out the following line and and things based off of it, it works fine. If I add only this line back in then it runs but the window never pops up.
string[] allLines = File.ReadAllLines("map1.txt");
I also have the statement to be sure it is included.
using System;
using System.IO;
If you’d like more code I can post it but it’s a pretty large amount.
OLD-EDIT: To clarify, no window would pop up like it normally would when i ran my game but also no error messages would popup either. My txt file was included in the content but for some reason wasn’t working. I used the full path and now it works!
I suggest using a fullpath here, as the file might not be in the place
that your program is trying to read from (and hence you get a problem in reading it).