Syntax for virtual members

前端 未结 4 1901
孤街浪徒
孤街浪徒 2021-01-12 05:21

Consider the following class written in c# .net 4.0 (typically found in a nhibernate class):

public class CandidateEntity : EntityBase
{
    public virtual I         


        
4条回答
  •  执笔经年
    2021-01-12 06:14

    The backing field is one way. Another is to use a private setter. This works well in nHibernate.

    public virtual IList Grades { get; private set; }
    
    public CandidateEntity()
    {
         Grades = new List();
    }
    

提交回复
热议问题