public RelationAttacher() { var d = new StackOverflowData(); var posts = d.GetPosts().rows; var questions = new Dictionary <int, RowAndIdx>(); var answers = new List <RowAndIdx>(); for (int i = 0; i < posts.Count; i++) { var post = posts[i]; if (post.PostTypeId == "1") { questions.Add(int.Parse(post.Id), new RowAndIdx { Row = post, Index = i + 1 }); } else { answers.Add(new RowAndIdx { Row = post, Index = i + 1 }); } } //for (int i = 0; i < answers.Count; i++) foreach (var answer in answers) { if (answer.Row.ParentId != null) { var question = questions[int.Parse(answer.Row.ParentId)]; AddRelation(question.Index, answer.Index); } } }
public DateAdder() { var d = new StackOverflowData(); var posts = d.GetPosts().rows; var postsWithIndexes = new List <RowAndIdx>(); for (int i = 0; i < posts.Count; i++) { var post = posts[i]; postsWithIndexes.Add(new RowAndIdx { Row = post, Index = i + 1 }); } foreach (var answer in postsWithIndexes) { AddCreatedDate(answer.Index, DateTime.ParseExact(answer.Row.CreationDate, "yyyy-MM-ddTHH:mm:ss.fff", CultureInfo.InvariantCulture)); } }