Пример #1
0
        /// <summary>
        /// 将指定的对象添加到数组的末尾。
        /// </summary>
        /// <param name="obj"></param>
        public void Add(T obj)
        {
            eventDelegate?.AddData(obj == null ? 0 : 1);

            if (obj != null)
            {
                lock (_lock)
                {
                    objects.Add(obj);
                }
            }

            _observer?.OnItemRangeInserted(GetCount() + 1, 1);

            if (_notifyOnChange)
            {
                NotifyItemInserted(headers.Count + GetCount() + 1);
            }

            Log("add NotifyItemInserted " + (headers.Count + GetCount() + 1));
        }
 /**
  * Adds the specified object at the end of the array.
  *
  * @param object The object to add at the end of the array.
  */
 public void add(T obj)
 {
     if (mEventDelegate != null)
     {
         mEventDelegate.addData(obj == null ? 0 : 1);
     }
     if (obj != null)
     {
         lock (mLock)
         {
             mObjects.Add(obj);
         }
     }
     if (mObserver != null)
     {
         mObserver.OnItemRangeInserted(getCount() + 1, 1);
     }
     if (mNotifyOnChange)
     {
         NotifyItemInserted(headers.Count() + getCount() + 1);
     }
     log("add NotifyItemInserted " + (headers.Count() + getCount() + 1));
 }