Let say, I have two entites such as Student and Department. There is one to many relationship between them.
Student.cs
public class Student
{
public int StudentId { get; set; }
public int StudentName { get; set; }
public int StudentRoll { get; set; }
public int DepartmentId { get; set; }
public Department Department { get; set; }
}
Department.cs
public class Department
{
public int DepartmentId { get; set; }
public int DepartmentName { get; set; }
public ICollection<Student> Students { get; set; }
}
Instead of using public ICollection<Student> Students { get; set; }
, I can use
public List<Student> Students { get; set; }
public IEnumerable<Student> Students { get; set; }
I saw it in various tutorial in Web. Which one should I use?? I know that it doesn't matter which one I am using but the result is always same. I want to know what is the best practice.