I have a code. the constructor should introduce the GetItems
function, but when I set a breakpoint, it just doesn't stop.
what is the problem?
namespace Storehouse { public partial class MainForm : Form { public MainForm() { InitializeComponent(); var a = GetItems(fILEToolStripMenuItem); } public IEnumerable<ToolStripMenuItem> GetItems(ToolStripMenuItem item) { foreach (ToolStripMenuItem dropDownItem in item.DropDownItems) { if (dropDownItem.HasDropDownItems) { foreach (ToolStripMenuItem subItem in GetItems(dropDownItem)) { yield return subItem; } yield return dropDownItem; } } } }
source share