private void IntiChild() { ChildList = new List <ProcessTreeMine>(); List <string> childs = GetChildOfProcess(); ResultList.Distinct(); for (int i = 0; i < ResultList.Count; i++) { if (!ResultList[i].StartsWith(" ")) { var index = ResultList[i].IndexOf(" "); if (index > 0) { ResultList[i] = ResultList[i].Substring(0, index); } } } ResultList.Distinct(); int from = 0, until = 0; foreach (var item in childs) { for (int i = 0; i < ResultList.Count; i++) { if (ResultList[i].StartsWith(item)) { from = i; break; } } for (int i = from + 1; i < ResultList.Count; i++) { if (ResultList[i].StartsWith(" ")) { until = i; } else { break; } } until = until == 0 ? from : until; if (from > 0) { ChildList.Add(new ProcessTreeMine(item, from, until, ResultList)); } } }