Esempio n. 1
0
        /// <summary>
        ///   Invokes setindex.
        /// </summary>
        /// <param name="target"> The target. </param>
        /// <param name="indexesThenValue"> The indexes then value. </param>
        public static void InvokeSetIndex(object target, params object[] indexesThenValue)
        {
            string[] tArgNames;
            Type     tContext;
            bool     tStaticContext;

            target           = target.GetTargetContext(out tContext, out tStaticContext);
            indexesThenValue = Util.GetArgsAndNames(indexesThenValue, out tArgNames);

            CallSite tCallSite = null;

            InvokeHelper.InvokeSetIndexCallSite(target, indexesThenValue, tArgNames, tContext, tStaticContext, ref tCallSite);
        }
Esempio n. 2
0
        /// <summary>
        /// Invokes setindex.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="indexesThenValue">The indexes then value.</param>
        public static object InvokeSetIndex(object target, params object[] indexesThenValue)
        {
            if (indexesThenValue.Length < 2)
            {
                throw new ArgumentException("Requires at least one index and one value", nameof(indexesThenValue));
            }

            target           = target.GetTargetContext(out var tContext, out var tStaticContext);
            indexesThenValue = Util.GetArgsAndNames(indexesThenValue, out var tArgNames);

            CallSite tCallSite = null;

            return(InvokeHelper.InvokeSetIndexCallSite(target, indexesThenValue, tArgNames, tContext, tStaticContext,
                                                       ref tCallSite));
        }