private TypeUsage GetIsOrAsTargetType(ExpressionType operationType, Type toClrType, Type fromClrType)
{
Debug.Assert(operationType == ExpressionType.TypeAs || operationType == ExpressionType.TypeIs);
// Interpret all type information
TypeUsage toType;
if (!TryGetValueLayerType(toClrType, out toType)
||
(!TypeSemantics.IsEntityType(toType) &&
!TypeSemantics.IsComplexType(toType)))
{
throw new NotSupportedException(
Strings.ELinq_UnsupportedIsOrAs(
operationType,
DescribeClrType(fromClrType), DescribeClrType(toClrType)));
}
return toType;
}