nature_net.user_controls.list_populator.add_children_to_list C# (CSharp) Метод

add_children_to_list() приватный Метод

private add_children_to_list ( List tmp, List main_list ) : void
tmp List
main_list List
Результат void
        private void add_children_to_list(List<comment_item_generic> tmp, List<List<comment_item_generic>> main_list)
        {
            // search through the main_list to find a place for insertion (main list should be kept sorted)
            DateTime max_date_tmp = tmp[0].comment.date;
            for (int t = 0; t < tmp.Count; t++)
                if (tmp[t].comment.date > max_date_tmp)
                    max_date_tmp = tmp[t].comment.date;
            for (int counter = 0; counter < main_list.Count; counter++)
            {
                List<comment_item_generic> candidate = main_list[counter];
                DateTime max_date_candidate = candidate[0].comment.date;
                for (int i = 0; i < candidate.Count; i++)
                    if (candidate[i].comment.date > max_date_candidate)
                        max_date_candidate = candidate[i].comment.date;
                if (max_date_tmp > max_date_candidate)
                {
                    main_list.Insert(counter, tmp);
                    return;
                }
            }
            main_list.Add(tmp);
        }