@QA User , I recommend that you could sort the Authors by name first the, you could sort the first Author by Name.
Here is a code example you could refer to.
foreach (var item in books)
{
item.Authors = item.Authors.OrderBy(i => i.Name).ToList(); //Sort the Authors by the Name
}
var list = books.OrderBy(i => i.Authors.FirstOrDefault().Name).ToList(); //Sort the books by the First Author Name
foreach (var item in list)
{
Console.WriteLine(item.Id+"**"+item.Title);
foreach (var au in item.Authors)
{
Console.WriteLine(au.Name);
Console.WriteLine("*******");
}
}
Result:
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.