ConversionInvalidResult() 정적인 개인적인 메소드

ArgumentException with message like "The conversion lambda result type '{0}' cannot be assigned to loop iteration variable type '{1}'"
static private ConversionInvalidResult ( object p0, object p1 ) : Exception
p0 object
p1 object
리턴 System.Exception
        private static void ValidateConversion(Type variableType, Type elementType, ref LambdaExpression conversion)
        {
            if (conversion != null)
            {
                if (conversion.Parameters.Count != 1)
                {
                    throw Error.ConversionNeedsOneParameter();
                }

                var convertParameterType = conversion.Parameters[0].Type;
                var convertResultType    = conversion.Body.Type;

                if (!AreReferenceAssignable(convertParameterType, elementType))
                {
                    throw Error.ConversionInvalidArgument(elementType, convertParameterType);
                }

                if (!AreReferenceAssignable(variableType, convertResultType))
                {
                    throw Error.ConversionInvalidResult(convertResultType, variableType);
                }
            }
            else if (!AreReferenceAssignable(variableType, elementType))
            {
                var element = Expression.Parameter(elementType, "__element");

                // NB: The LINQ factory will perform the necessary checks.
                // NB: If checked conversion is needed, one should explicitly specify a conversion lambda.
                var convert = Expression.Convert(element, variableType);

                conversion = Expression.Lambda(convert, element);
            }
        }