Consider the following class written in c# .net 4.0 (typically found in a nhibernate class):
public class CandidateEntity : EntityBase
{
public virtual IList<GradeEntity> Grades { get; set; }
public CandidateEntity()
{
Grades = new List<GradeEntity>();
}
}
This line gets a well founded warning “virtual member call in the constructor”.
Where shall I initialize this collection ?
Regards,
The backing field is one way. Another is to use a private setter. This works well in nHibernate.