Exemplo n.º 1
0
        /// <summary>
        /// Gets or sets at index.
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public T this[Integerx1 index]
        {
            get
            {
                if (index.Generator != this.Generator)
                {
                    throw new ArgumentException("Different generators combined.");
                }

                IndexInArrayOperation op = new IndexInArrayOperation();
                op.BindInputs(this.pin, index.Pin);
                return((T)Generator.CreateFrom(op.Outputs[0]));
            }
            set
            {
                if (index.Generator != this.Generator)
                {
                    throw new ArgumentException("Different generators combined.");
                }

                WriteToIndexInArrayOperation op = new WriteToIndexInArrayOperation();
                op.BindInputs(this.pin, index.Pin, value.Pin);

                // New array is created, we copy to our pin.
                this.pin = op.Outputs[0];
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets or sets at index.
        /// </summary>
        public T this[uint index]
        {
            get
            {
                IndexInArrayOperation op = new IndexInArrayOperation();
                op.BindInputs(this.pin, Generator.Fixed(index).Pin);
                return((T)Generator.CreateFrom(op.Outputs[0]));
            }
            set
            {
                WriteToIndexInArrayOperation op = new WriteToIndexInArrayOperation();
                op.BindInputs(this.pin, Generator.Fixed(index).Pin, value.Pin);

                // New array is created, we copy to our pin.
                this.pin = op.Outputs[0];
            }
        }