private static Expression EnumEquals(Expression exp1, Expression exp2) { var exp1Clean = RemoveConvertChain(exp1); var exp2Clean = RemoveConvertChain(exp2); if (exp1 != exp1Clean || exp2 != exp2Clean) { var type = exp2.Type.IsNullable() ? exp1.Type.Nullify(): exp1.Type; return(SmartEqualizer.EqualNullable(exp1Clean.TryConvert(type), exp2Clean.TryConvert(type))); } return(null); }
private static Expression EnumEquals(Expression exp1, Expression exp2) { var exp1Clean = RemoveConvertChain(exp1); var exp2Clean = RemoveConvertChain(exp2); if (exp1Clean.Type.UnNullify() == typeof(DayOfWeek) || exp2Clean.Type.UnNullify() == typeof(DayOfWeek)) { return(SmartEqualizer.EqualNullable( ConstantToDayOfWeek(exp1Clean) ?? exp1Clean, ConstantToDayOfWeek(exp2Clean) ?? exp2Clean)); } if (exp1 != exp1Clean || exp2 != exp2Clean) { var type = exp2.Type.IsNullable() ? exp1.Type.Nullify(): exp1.Type; return(SmartEqualizer.EqualNullable(exp1Clean.TryConvert(type), exp2Clean.TryConvert(type))); } return(null); }