private static ToolboxItem GetCachedToolboxItem(System.Type itemType) { ToolboxItem toolboxItem = null; if (CachedToolboxItems == null) { CachedToolboxItems = new Dictionary <System.Type, ToolboxItem>(); } else if (CachedToolboxItems.ContainsKey(itemType)) { return(CachedToolboxItems[itemType]); } if (toolboxItem == null) { toolboxItem = ToolboxService.GetToolboxItem(itemType); if (toolboxItem == null) { toolboxItem = new ToolboxItem(itemType); } } CachedToolboxItems[itemType] = toolboxItem; if ((CustomToolStripItemCount > 0) && ((CustomToolStripItemCount * 2) < CachedToolboxItems.Count)) { CachedToolboxItems.Clear(); } return(toolboxItem); }