public MemberExpression CreateMemberAccessor(Expression expr, int index)
        {
            var name = AnonType.IndexToField(index);

            return(UseBuiltInTypes
                ? Expression.Field(expr, name)
                : Expression.Property(expr, name));
        }
        public static Type CreateType(Type[] memberTypes)
        {
            var props = Array.CreateInstance(PROP_TYPE, memberTypes.Length);

            for (var i = 0; i < memberTypes.Length; i++)
            {
                props.SetValue(Activator.CreateInstance(PROP_TYPE, AnonType.IndexToField(i), memberTypes[i]), i);
            }
            return((Type)CREATE_TYPE_METHOD.Invoke(null, new object[] { props, true }));
        }
        public Expression CreateNewExpression(AnonTypeNewTweaks tweaks)
        {
            if (UseBuiltInTypes)
            {
                return(AnonType.CreateNewExpression(MemberExpressions, tweaks));
            }

            var typeArguments = MemberExpressions.Select(i => i.Type).ToArray();
            var type          = DynamicClassBridge.CreateType(typeArguments);

            return(AnonType.CreateNewExpression(type, typeArguments, MemberExpressions, false));
        }
 public static object GetMember(object obj, int index)
 => INDEXER_METHOD.Invoke(obj, new object[] { AnonType.IndexToField(index) });