I want to do a nested loop inside a function, but the member of the 2nd loop is decided by the function argument, how to make it work? Something like this:
List<Book> listBook;
List<Employee> listEmployee;
class Book
{
    string title;
    List <string> chapters;
}
class Employee
{
    string name;
    List <string> skills;
    List <string> jobs;
}
void Loop(List<object> list, Member mem)
{
    foreach (var i in list)
    {
        foreach (var j in i.mem)
        {
            string str = (string)j;
            ..................
        }
    }
}
void Main()
{
    Loop(listBook, Book.chapters);
    Loop(listEmployee, Employee.jobs);
}
 
     
    