System.Runtime.Remoting.Contexts.DynamicPropertyHolder.GrowDynamicSinksArray C# (CSharp) Метод

GrowDynamicSinksArray() приватный статический Метод

private static GrowDynamicSinksArray ( IDynamicMessageSink sinks ) : IDynamicMessageSink[]
sinks IDynamicMessageSink
Результат IDynamicMessageSink[]
        private static IDynamicMessageSink[] GrowDynamicSinksArray(IDynamicMessageSink[] sinks)
        {
            // grow the array
            int newSize = (sinks != null ? sinks.Length : 0)  + GROW_BY;
            IDynamicMessageSink[] newSinks = new IDynamicMessageSink[newSize];
            if (sinks != null)
            {
                // Copy existing properties over
                // Initial size should be chosen so that this rarely happens
                Array.Copy(sinks, newSinks, sinks.Length);
            }
            return newSinks;
        }
    

Usage Example

        internal virtual bool AddDynamicProperty(IDynamicProperty prop)
        {
            bool result;

            lock (this)
            {
                DynamicPropertyHolder.CheckPropertyNameClash(prop.Name, this._props, this._numProps);
                bool flag2 = false;
                if (this._props == null || this._numProps == this._props.Length)
                {
                    this._props = DynamicPropertyHolder.GrowPropertiesArray(this._props);
                    flag2       = true;
                }
                IDynamicProperty[] props = this._props;
                int numProps             = this._numProps;
                this._numProps  = numProps + 1;
                props[numProps] = prop;
                if (flag2)
                {
                    this._sinks = DynamicPropertyHolder.GrowDynamicSinksArray(this._sinks);
                }
                if (this._sinks == null)
                {
                    this._sinks = new IDynamicMessageSink[this._props.Length];
                    for (int i = 0; i < this._numProps; i++)
                    {
                        this._sinks[i] = ((IContributeDynamicSink)this._props[i]).GetDynamicSink();
                    }
                }
                else
                {
                    this._sinks[this._numProps - 1] = ((IContributeDynamicSink)prop).GetDynamicSink();
                }
                result = true;
            }
            return(result);
        }
All Usage Examples Of System.Runtime.Remoting.Contexts.DynamicPropertyHolder::GrowDynamicSinksArray