Find() private méthode

private Find ( string key, bool searchAllChildren ) : System.Windows.Forms.ToolStripItem[]
key string
searchAllChildren bool
Résultat System.Windows.Forms.ToolStripItem[]
Exemple #1
0
        static ToolStripItem Find(ToolStripItemCollection items, String key, bool searchAllChildren)
        {
            var tis = items.Find(key, searchAllChildren);
            if (tis != null && tis.Length > 0) return tis[0];

            foreach (ToolStripItem item in items)
            {
                if (item.Text.EqualIgnoreCase(key)) return item;
            }
            if (searchAllChildren)
            {
                foreach (ToolStripItem item in items)
                {
                    var tdi = item as ToolStripDropDownItem;
                    if (tdi != null)
                    {
                        var ti = Find(tdi.DropDownItems, key, searchAllChildren);
                        if (ti != null) return ti;
                    }
                }
            }

            return null;
        }