MemberBind() public static method

Creates a MemberMemberBinding that represents the recursive initialization of members of a field or property.
public static MemberBind ( MemberInfo member ) : MemberMemberBinding
member System.Reflection.MemberInfo The to set the property equal to.
return MemberMemberBinding
        protected virtual MemberMemberBinding VisitMemberMemberBinding(MemberMemberBinding binding)
        {
            IEnumerable <MemberBinding> bindings = this.VisitBindingList(binding.Bindings);

            if (bindings != binding.Bindings)
            {
                return(Expression.MemberBind(binding.Member, bindings));
            }
            return(binding);
        }
示例#2
0
        protected virtual MemberMemberBinding VisitMemberMemberBinding(MemberMemberBinding binding)
        {
            ReadOnlyCollection <MemberBinding> bindingExp = VisitBindingList(binding.Bindings);

            if (bindingExp != binding.Bindings)
            {
                return(Expression.MemberBind(binding.Member, bindingExp));
            }
            return(binding);
        }
示例#3
0
        /// <summary>
        /// Visits the children of the <see cref="MemberMemberBinding" />.
        /// </summary>
        /// <param name="node">The expression to visit.</param>
        /// <returns>The modified expression, if it or any subexpression was modified;
        /// otherwise, returns the original expression.</returns>
        protected virtual MemberMemberBinding VisitMemberMemberBinding(MemberMemberBinding node)
        {
            var bindings = VisitBindingList(node.Bindings);

            if (bindings != node.Bindings)
            {
                return(Expression.MemberBind(node.Member, bindings));
            }
            return(node);
        }
示例#4
0
        internal virtual MemberMemberBinding VisitMemberMemberBinding(MemberMemberBinding binding)
        {
            IEnumerable <MemberBinding> enumerable = this.VisitBindingList(binding.Bindings);

            if (enumerable != binding.Bindings)
            {
                return(Expression.MemberBind(binding.Member, enumerable));
            }
            return(binding);
        }
        internal virtual MemberMemberBinding VisitMemberMemberBinding(MemberMemberBinding binding)
        {
            var bindings = VisitBindingList(binding.Bindings);

            if (bindings != binding.Bindings)
            {
                return(Expression.MemberBind(binding.Member, bindings));
            }
            return(binding);
        }
示例#6
0
        private static MemberMemberBinding UpdateMemberMemberBinding(
            MemberMemberBinding node,
            MemberInfo member,
            IEnumerable <MemberBinding> bindings)
        {
            if (bindings != node.Bindings || member != node.Member)
            {
                return(Expression.MemberBind(member, bindings));
            }

            return(node);
        }
        /// <summary>
        /// Creates a new expression that is like this one, but using the
        /// supplied children. If all of the children are the same, it will
        /// return this expression.
        /// </summary>
        /// <param name="bindings">The <see cref="Bindings"/> property of the result.</param>
        /// <returns>This expression if no children changed, or an expression with the updated children.</returns>
        public MemberMemberBinding Update(IEnumerable <MemberBinding> bindings)
        {
            if (bindings != null)
            {
                if (ExpressionUtils.SameElements(ref bindings, Bindings))
                {
                    return(this);
                }
            }

            return(Expression.MemberBind(Member, bindings));
        }
        public void MemberInit_member_bind()
        {
            var expression =
                LinqExpression.MemberInit(
                    LinqExpression.New(
                        typeof(SampleClass)),
                    LinqExpression.MemberBind(
                        typeof(SampleClass).GetField(nameof(SampleClass.ComplexField)),
                        LinqExpression.Bind(
                            typeof(SampleClass).GetField(nameof(SampleClass.InstanceField)),
                            LinqExpression.Constant(
                                string.Empty))));

            ShouldRoundrip(expression);
        }
示例#9
0
        protected virtual MemberMemberBinding VisitMemberMemberBinding(MemberMemberBinding binding)
        {
            var bindings = VisitBindingList(binding.Bindings);

            return(bindings != binding.Bindings ? Expression.MemberBind(binding.Member, bindings) : binding);
        }
示例#10
0
 /// <inheritdoc />
 protected override MemberMemberBinding VisitMemberMemberBinding(MemberMemberBinding binding) => Expression.MemberBind(binding.Member, VisitBindingList(binding.Bindings));
示例#11
0
        /// <summary>
        /// Visits the children of the <see cref="MemberMemberBinding" />.
        /// </summary>
        /// <param name="node">
        /// The expression to visit.
        /// </param>
        /// <returns>The modified expression, if it or any subexpression was modified;
        /// otherwise, returns the original expression.
        /// </returns>
        protected virtual MemberMemberBinding VisitMemberMemberBinding(MemberMemberBinding node)
        {
            var bindings = this.VisitBindingList(node.Bindings);

            return(bindings != node.Bindings ? Expression.MemberBind(node.Member, bindings) : node);
        }
示例#12
0
 public static MemberMemberBinding MemberBind(MemberInfo member, MemberBinding[] bindings) => Expression.MemberBind(member, bindings);                     // NB: Used for fields.
 public static MemberMemberBinding MemberBind(MethodInfo propertyAccessor, MemberBinding[] bindings) => Expression.MemberBind(propertyAccessor, bindings); // NB: Used for properties.
示例#13
0
 public static MemberMemberBinding MemberBind(MemberInfo member, MemberBinding[] bindings) => Expression.MemberBind(member, bindings);                     // NB: Used for fields.
示例#14
0
        private MemberMemberBinding VisitMemberMemberBinding(MemberMemberBinding binding)
        {
            var bindings = VisitBindingList(binding.Bindings);

            return(bindings != binding.Bindings ? Expression.MemberBind(binding.Member, bindings) : binding);
        }