コード例 #1
0
        }    //end of constructor

        public void Add(string question, string Answer)
        {
            Question_Answer ques_Ans = new Question_Answer();

            ques_Ans.ADD(question, Answer);
            string key = ques_Ans.question[0].ToUpper()[0].ToString();

            key = generatekey(key);
            collection.Add(key, ques_Ans);
        }    //end of overload Adding new question and answer in collection method
コード例 #2
0
        }    //end of genreating key method()

        public void RetrieveDataFromFile()
        {
            StreamReader reader     = new StreamReader(@"Questions.txt", true);
            StreamReader ReadAnswer = new StreamReader(@"Answers.txt", true);

            while (reader.EndOfStream == false)
            {
                string   temp = "";
                string[] a;
                string[] b;

                temp = reader.ReadLine();
                a    = temp.Split('|');
                temp = ReadAnswer.ReadLine();
                b    = temp.Split('|');

                Question_Answer q = new Question_Answer();
                q.ADD(a, b);
                Add(q);
            }

            reader.Close();
            ReadAnswer.Close();
        }    //end of retrive data from file method