c# - Get all nodes in a tree -
i have little issue following program
internal ienumerable<t> getitems<t>(string nodename) t : root, new() { var node = new t(); return getitems(nodename, node).cast<t>(); } public ienumerable<root> getitems(string nodename, root root) { // }
i know how change c++ code. have tried
template<class t> list<t> getitems(string nodename) { auto node = new t(); return getitems(nodename, node); } list<root> getitems(string nodename, root root) { // }
now mess little
typedef shared_ptr<root> root_ptr; class smallroot:public root{}; list<root_ptr> getitems(string nodename, root_ptr rootptr) { //do , return list of share pointers }
then stuck @ how redesign template getitems
feed smallroot
classes
Comments
Post a Comment