System.Linq.Expressions.Expression.ElementInit C# (CSharp) Method

ElementInit() public static method

Creates an Expressions.ElementInit expression that represents the initialization of a list.
public static ElementInit ( MethodInfo addMethod ) : ElementInit
addMethod System.Reflection.MethodInfo The for the list's Add method.
return ElementInit
        public static ElementInit ElementInit(MethodInfo addMethod, params Expression[] arguments)
        {
            return ElementInit(addMethod, arguments as IEnumerable<Expression>);
        }

Same methods

Expression::ElementInit ( MethodInfo addMethod, IEnumerable arguments ) : ElementInit

Usage Example

コード例 #1
0
        public void ListInit()
        {
            var expression =
                LinqExpression.ListInit(
                    LinqExpression.New(
                        typeof(List <long>)),
                    LinqExpression.ElementInit(
                        typeof(List <long>).GetMethod("Add"),
                        LinqExpression.Constant(0L)));

            ShouldRoundrip(expression);
        }
All Usage Examples Of System.Linq.Expressions.Expression::ElementInit
Expression