Ejemplo n.º 1
0
            public int Add(object item)
            {
                //this.owner.CheckNoSharedCell();
                owner.CheckNoDataSource();

                ArgumentNullException.ThrowIfNull(item);

                int index = InnerArray.Add(item);

                bool success = false;

                if (owner.Sorted)
                {
                    try
                    {
                        InnerArray.Sort(Comparer);
                        index   = InnerArray.IndexOf(item);
                        success = true;
                    }
                    finally
                    {
                        if (!success)
                        {
                            InnerArray.Remove(item);
                        }
                    }
                }

                owner.OnItemsCollectionChanged();
                return(index);
            }