Example #1
0
        /// <summary>
        /// Execute the element by accepting the index of execution.
        /// index of execution may differ on IndexInParentSequence.
        /// </summary>
        /// <param name="executionIndex">The real calling index.</param>
        /// <returns></returns>
        public QsValue Execute(int executionIndex)
        {
            if (ElementValue.GetType() == typeof(Func <int, QsValue>))
            {
                return(((Func <int, QsValue>)ElementValue)(executionIndex));
            }
            else if (ElementValue.GetType() == typeof(QsSequence))
            {
                QsSequence seq = (QsSequence)ElementValue;

                return((QsValue)seq.GetElementValue(executionIndex));
            }
            else
            {
                return((QsValue)ElementValue);
            }
        }