I have 1:N relationship between Program and Student tables which EF converted into navigation property. Now I want to delete all those records in this navigation students. I started like this:
foreach(Student student in program.Students)
program.Students.Remove(student);
But I am a little bit skeptical about this.
Than I tried this way:
while (program.Students.Count > 0)
program.Students.Remove(program.Students.ToList()[0]);
But this seems weird too.
Is there some simpler way to do this or if not which way is the best?