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

ValidateGotoType() private static method

private static ValidateGotoType ( Type expectedType, Expression &value, string paramName ) : void
expectedType Type
value Expression
paramName string
return void
        private static void ValidateGotoType(Type expectedType, ref Expression value, string paramName)
        {
            RequiresCanRead(value, paramName);
            if (expectedType != typeof(void))
            {
                if (!TypeUtils.AreReferenceAssignable(expectedType, value.Type))
                {
                    // C# auto-quotes return values, so we'll do that here
                    if (!TryQuote(expectedType, ref value))
                    {
                        throw Error.ExpressionTypeDoesNotMatchLabel(value.Type, expectedType);
                    }
                }
            }
        }
    }
Expression