这是我的代码:
public static class s {
public static int Dx(this int i, Action<int> act, Func<int, bool> con) {
if (con(i)) act(i);
return i;
}
}
稍后在我的代码中,我这样做:
int g = 22;
int false_con = g.Dx(j => j = 11, z => z != 22); // This is 22 which is fine.
int true_con = g.Dx(j => j = 11, z => z == 22); //This is also 22 which should be 11
如何解决这个问题?