Remove object from generic list by id

前端 未结 6 1422
你的背包
你的背包 2021-02-07 10:50

I have a domain class like this:

public class DomainClass
{
  public virtual string name{get;set;}
  public virtual IList Notes{get;set;}
}
         


        
6条回答
  •  长情又很酷
    2021-02-07 11:30

    Please consider, that in some cases better to avoid public virtuals, use template method pattern in such a way:

     public void Load(IExecutionContext context) 
     { 
          // Can safely set properties, call methods, add events, etc...
          this.Load(context);            
          // Can safely set properties, call methods, add events, etc. 
     }
    
     protected virtual void Load(IExecutionContext context) 
     {
     }
    

提交回复
热议问题