public static Addin[] GetAllAddins(this AddinRegistry registry, Func <Addin, string> sortItemSelector = null) { if (sortItemSelector == null) { sortItemSelector = x => x.Id; } var array = registry.GetModules(AddinSearchFlags.IncludeAll | AddinSearchFlags.LatestVersionsOnly); var comparer = new NameComparer(sortItemSelector); Array.Sort(array, comparer); return(array); }