C# 函数方法内部实现循环调用自身

//C# 函数方法内部实现循环调用自身 
void TreeViewFresh(){
    Action addNode
     = (TreeNodeCollection, MenuItem) => { }; addNode = (tn, mn) =>{ if (mn.Text != "-"){ tn.Add(mn.Text, mn.Text); if (mn.IsParent) foreach (MenuItem mnn in mn.MenuItems) addNode(tn[mn.Text].Nodes, mnn); } }; TreeView1.Nodes.Clear(); foreach (MenuItem mn in mainMenu1.MenuItems) addNode(TreeView1.Nodes, mn); }

 

转载于:https://www.cnblogs.com/leavind/p/5820558.html

你可能感兴趣的:(C# 函数方法内部实现循环调用自身)