I have two entities that are something like that:
public class Movie
{
public int MovieID { get; set; }
public string Title { get; set; }
public List<Director> Directors { get; set; };
public int Year { get; set; }
}
public class Director
{
public int DirectorID { get; set; }
public string Name { get; set; }
public List<Movie> Movies { get; set; }
}
Let’s say I want to order a list of Movies by the name of the Director:
Movies.OrderBy (??? => ???)
How can I do that?
Thanks in advance.
1 Answer