Exemplo n.º 1
0
        private EvalResult EvaluateObjectArray(EvalResult target,
                                               EvalResult[] args,
                                               object thisObject)
        {
            // We know the value is an actual array instance
            Array array = (Array)target.Value;

            // Must have same number of arguments as the array rank
            if (array.Rank != args.Length)
            {
                throw new ApplicationException("Array expects '" + array.Rank.ToString() + "' indices but '" + args.Length.ToString() + "' have been specified.");
            }

            // Construct the set of indices for accessing array
            long[] indices = new long[args.Length];
            for (int i = 0; i < args.Length; i++)
            {
                indices[i] = ImplicitConverter.ConvertToInt64(args[i].Value, _language);
            }

            EvalResult ret = new EvalResult();

            ret.Value = array.GetValue(indices);
            return(DiscoverTypeCode(ret));
        }