Пример #1
0
        private Expression <Func <T, object[]> > CreateToObjectsMethod()
        {
            var item = Expression.Parameter(Type);

            return(Expression.Lambda <Func <T, object[]> >(ObjectsHelper.ToObjects(item, MembersOrder), item));
        }
Пример #2
0
        private Expression <Func <IData, object[]> > CreateToObjectsMethod()
        {
            var data = Expression.Parameter(typeof(IData), "data");

            var d    = Expression.Variable(typeof(Data <>).MakeGenericType(Type), "d");
            var body = Expression.Block(new ParameterExpression[] { d }, Expression.Assign(d, Expression.Convert(data, d.Type)), ObjectsHelper.ToObjects(d.Value(), MembersOrder));

            return(Expression.Lambda <Func <IData, object[]> >(body, data));
        }