示例#1
0
 /// <summary>See <see cref="CsExpression.ToLinqExpression"/>.</summary>
 public override Expression ToLinqExpression(NameResolver resolver, bool isChecked)
 {
     var operand = ToResolveContext(Operand, resolver, isChecked);
     var type = resolver.ResolveType(Type);
     if (operand is ResolveContextLambda)
         throw new NotImplementedException();
     return Expression.Convert(operand.ToExpression(), type);
 }
示例#2
0
        /// <summary>See <see cref="CsExpression.ToLinqExpression"/>.</summary>
        public override Expression ToLinqExpression(NameResolver resolver, bool isChecked)
        {
            if (isImplicit())
                throw new InvalidOperationException("The implicitly-typed lambda expression “{0}” cannot be translated to a LINQ expression without knowing the types of its parameters. Use the ToLinqExpression(NameResolver,Type[]) overload to specify the parameter types.".Fmt(ToString()));

            var prmTypes = new Type[Parameters.Count];
            for (int i = 0; i < Parameters.Count; i++)
                prmTypes[i] = resolver.ResolveType(Parameters[i].Type);
            return ToLinqExpression(resolver, prmTypes, isChecked);
        }