ComponentFactory.Krypton.Toolkit.ViewComposite.this C# (CSharp) Method

this() public method

Gets or sets the view at the specified index.
public this ( int index ) : ViewBase
index int ViewBase index.
return ViewBase
        public override ViewBase this[int index]
        {
            get
            {
                if (_views != null)
                    return _views[index];
                else
                    return null;
            }

            set
            {
                // We do not allow null references in the collection
                if (value == null)
                    throw new ArgumentNullException("Cannot set a null view into a composite view.");

                if (_views != null)
                {
                    // Cache reference to removing item
                    ViewBase item = _views[index];

                    // Let type safe collection perform operation
                    _views[index] = value;

                    // Remove back reference of old item
                    item.Parent = null;

                    // Setup back reference to new item
                    value.Parent = this;
                }
            }
        }