You can use the Select
and Aggregate
LINQ methods to create a comma-separated string of all teacher names. Here's how you can do it:
List<Teacher> teachers = new List<Teacher>
{
new Teacher { teacherId = "1", teacherName = "Teacher1" },
new Teacher { teacherId = "2", teacherName = "Teacher2" },
// ... other teachers ...
};