public ICollection BuildItems(Codon codon, object owner) { var items = new System.Windows.Controls.MenuItem[ToolLoader.Tool.Count]; for (int i = 0; i < ToolLoader.Tool.Count; ++i) { ExternalTool tool = ToolLoader.Tool[i]; items[i] = new System.Windows.Controls.MenuItem { Header = tool.ToString() }; items[i].Click += delegate { RunTool(tool); }; } return(items); }