Docear4Word.DocumentController.GroupByAuthor C# (CSharp) Method

GroupByAuthor() static private method

static private GroupByAuthor ( List entries ) : List
entries List
return List
        static List<EntryAndPagePair[]> GroupByAuthor(List<EntryAndPagePair> entries)
        {
            var result = new List<EntryAndPagePair[]>();
            var noAuthorDistinguisher = 0;

            var authorGroupings = entries
                .GroupBy(entry => !string.IsNullOrEmpty(entry.Authors) ? entry.Authors : "_" + (++noAuthorDistinguisher).ToString())
                .OrderBy(g => g.Key, StringComparer.OrdinalIgnoreCase);

            foreach (var authorGroup in authorGroupings)
            {
                result.Add(authorGroup.ToArray());
            }

            return result;
        }