示例#1
0
 /// <summary>
 /// 将对象添加到集合尾处,如果对象已经存在,则不添加.
 /// </summary>
 /// <param name="entity">要添加的对象</param>
 /// <returns>返回添加到的地方</returns>
 public virtual int AddEntity(EntityNoName entity)
 {
     foreach (EntityNoName en in this)
     {
         if (en.No == entity.No)
         {
             return(0);
         }
     }
     return(this.InnerList.Add(entity));
 }
示例#2
0
        /// <summary>
        /// 将对象添加到集合尾处,如果对象已经存在,则不添加
        /// </summary>
        /// <param name="entity">要添加的对象</param>
        /// <returns>返回添加到的地方</returns>
        public virtual void Insert(int index, EntityNoName entity)
        {
            foreach (EntityNoName en in this)
            {
                if (en.No == entity.No)
                {
                    return;
                }
            }

            this.InnerList.Insert(index, entity);
        }