ExpressionTypeDoesNotMatchLabel() статический приватный Метод

ArgumentException with message like "Expression of type '{0}' cannot be used for label of type '{1}'"
static private ExpressionTypeDoesNotMatchLabel ( object p0, object p1 ) : Exception
p0 object
p1 object
Результат System.Exception
Пример #1
0
 // Standard argument validation, taken from ValidateArgumentTypes
 private static void ValidateGotoType(Type expectedType, ref Expression value, string paramName)
 {
     RequiresCanRead(value, paramName);
     if (!TypeUtils.AreReferenceAssignable(expectedType, value.Type))
     {
         // C# autoquotes return values, so we'll do that here
         if (TypeUtils.IsSameOrSubclass(typeof(Expression), expectedType) &&
             expectedType.IsAssignableFrom(value.GetType()))
         {
             value = Expression.Quote(value);
         }
         throw Error.ExpressionTypeDoesNotMatchLabel(value.Type, expectedType);
     }
 }
Пример #2
0
 // Standard argument validation, taken from ValidateArgumentTypes
 private static void ValidateGotoType(Type expectedType, ref Expression value, string paramName)
 {
     ExpressionUtils.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);
             }
         }
     }
 }