private IList<Quiz> LoadQuizzes(IDataReader reader) { IList<Quiz> quizzes = new List<Quiz>(); while (reader.Read()) { Quiz quiz = new Quiz(reader.GetString(reader.GetOrdinal("QuizTopic")), reader.GetString(reader.GetOrdinal("Period")), reader.IsDBNull(reader.GetOrdinal("PeriodYear")) ? null : (int?)reader.GetInt32(reader.GetOrdinal("PeriodYear"))); quizzes.Add(quiz); _IdsByHashCode.Add(quiz.GetHashCode(), reader.GetInt32(reader.GetOrdinal("QuizDefinitionID"))); } return quizzes; }
public object IdOf(Quiz item) { return _IdsByHashCode[item.GetHashCode()]; }