Recursion with delagates
i wish write following code error variable not inialized.
delegate void recur(treenodecollection nodes); public void showkeywords(string message){
list<treenode> list = new list<treenode>(); recur recur = delegate(treenodecollection nodes){
foreach (treenode node in nodes){
list.add(node);
recur(node.nodes);
}
};
recur(treeview1.nodes);
--
error
error 12 use of unassigned local variable 'recur'
it possible modify
recur recur = delegate(treenodecollection nodes)
to
recur recur = null;
recur = delegate(treenodecollection nodes)
but think worth modify c# bit make first code possible.
xoid wrote: | |
|
the problem, i'm seeing in code have not initialized nodes where, nodes defined , intialized?
best regards,
Archived Forums V > Visual C# Language
Comments
Post a Comment