public TestCollections(int count) { ExpStack = new Stack <Experiment>(); StringStack = new Stack <string>(); DictionaryExps = new Dictionary <Experiment, Exam>(); DictionaryString = new Dictionary <string, Exam>(); for (int i = 0; i < count; i++) { Exam exam = new Exam(); Experiment experiment = exam.GetBaseExperiment(); ExpStack.Push(experiment); StringStack.Push(experiment.GetInformation()); DictionaryExps.Add(experiment, exam); DictionaryString.Add(experiment.GetInformation(), exam); if (i == 0) { firstObject = (Exam)exam.Clone(); } if (i == count / 2) { middleObject = (Exam)exam.Clone(); } if (i == count - 1) { lastObject = (Exam)exam.Clone(); } } }
public void RefactorObjects() { int i = 0; foreach (Experiment experiment in ExpStack) { Exam exam = (Exam)DictionaryExps[experiment].Clone(); if (i == 0) { firstObject = (Exam)exam.Clone(); } if (i == ExpStack.Count / 2) { middleObject = (Exam)exam.Clone(); } if (i == ExpStack.Count - 1) { lastObject = (Exam)exam.Clone(); } i++; } }
public QuestionModel Clone() { return(new QuestionModel() { ID = ID, No = No, Subject = Subject?.Clone(), Exam = Exam?.Clone(), Question = Question, VariantA = VariantA, VariantB = VariantB, VariantC = VariantC, VariantD = VariantD, VariantE = VariantE, TrueAnswer = TrueAnswer }); }