public static UnaryExpression IsTrue(Expression expression, MethodInfo method)
{
RequiresCanRead(expression, nameof(expression));
if (method == null)
{
if (expression.Type.IsBool())
{
return new UnaryExpression(ExpressionType.IsTrue, expression, expression.Type, null);
}
return GetUserDefinedUnaryOperatorOrThrow(ExpressionType.IsTrue, "op_True", expression);
}
return GetMethodBasedUnaryOperator(ExpressionType.IsTrue, expression, method);
}