private List<Scope> fetchSubCategories(Scope sco, List<Scope> values) { values.Add(sco); foreach (ComponentModel sc in sco.getSubComponents()) { if (sc.GetType() == typeof(Scope)) { values = this.fetchSubCategories((Scope)sc, values); } } return values; }
private void fetchSubCategories(Scope scope, string prefix, ListBox lbox) { KeyValue keyValue = new KeyValue(); keyValue.key = scope.getId().ToString(); keyValue.value = prefix + scope.getName(); lbox.Items.Add(keyValue); foreach (ComponentModel sco in scope.getSubComponents()) { if (sco.GetType() == typeof(Scope)) { this.fetchSubCategories((Scope)sco, "- " + prefix, lbox); } } }