c# - Asynchronous function call inside tree loader extension function -
c# - Asynchronous function call inside tree loader extension function - i have function load children of node. internally calls wcf async service load. signature follows. public void addchildelements(node parentelement, action<ienumerable<node>> callback) { } this can used like _nodebuilder.addchildelements(parentelement, (elements) => { //do elements }); now want write function expand hierarchy based on condition. write extension function this public static t loadhierarchyuntilitemfound<t>( ienumerable<t> sequence, func<t, list<t>> loadaction, func<t, string> searchstring) { //... } the loadaction parameter expects loading function node.the usage follows elements.loadhierarchyuntilitemfound(loadchildren, "root.uk.england.london"); ...