Esempio n. 1
0
        /// <summary>
        /// Creates a <see cref="Fasterflect.MultiSetter"/> which sets the values of the given members.
        /// </summary>
        /// <param name="type">The <see cref="Type"/> whose members will be set.</param>
        /// <param name="members">The members to set.</param>
        /// <returns>A <see cref="Fasterflect.MultiSetter"/> which sets the values of the given members.</returns>
        public static MultiSetter MultiSetter(Type type, IList <MemberInfo> members)
        {
            MultiSetCallInfo callInfo = new MultiSetCallInfo(type, members);
            MultiSetter      value    = MultiSetters.Get(callInfo);

            if (value != null)
            {
                return(value);
            }
            value = (MultiSetter) new MultiSetEmitter(type, members).GetDelegate();
            MultiSetters.Insert(callInfo, value);
            return(value);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a <see cref="Fasterflect.MultiSetter"/> which sets the values of the given members.
        /// </summary>
        /// <param name="type">The <see cref="Type"/> whose members will be set.</param>
        /// <param name="bindingFlags">The <see cref="BindingFlags"/> or <see cref="FasterflectFlags"/> to filter the members.</param>
        /// <param name="memberNames">The names of the members to set.</param>
        /// <returns>A <see cref="Fasterflect.MultiSetter"/> which sets the values of the given members.</returns>
        public static MultiSetter MultiSetter(Type type, FasterflectFlags bindingFlags, params string[] memberNames)
        {
            MultiSetCallInfo callInfo = new MultiSetCallInfo(type, bindingFlags, memberNames);
            MultiSetter      value    = MultiSetters.Get(callInfo);

            if (value != null)
            {
                return(value);
            }
            value = (MultiSetter) new MultiSetEmitter(callInfo).GetDelegate();
            MultiSetters.Insert(callInfo, value);
            return(value);
        }