Hello,
I am trying to load a dictionary<string, string> with questions and answers from a text file.
I have a text file with 2000 questions and answers... each line contains one question and a corresponding answer formatted like this question*answer...
I am using a stream reader to read the file and split the questions from the answers
here is the function to load the dictionary
any help is appreciated
Thank You
InkedGFX
I am trying to load a dictionary<string, string> with questions and answers from a text file.
I have a text file with 2000 questions and answers... each line contains one question and a corresponding answer formatted like this question*answer...
I am using a stream reader to read the file and split the questions from the answers
here is the function to load the dictionary
private void Load_General_Knowledge() { using (StreamReader reader = new StreamReader(@"Assets\Questions\RandomQuestions.txt")) { string Line = ""; while ((Line = reader.ReadLine()) != null) { string[] splitLine = Line.Split('*'); if (questions.ContainsKey(splitLine[0])) { return; } else questions.Add(splitLine[0], splitLine[1]); } } }
any help is appreciated
Thank You
InkedGFX