I think I'm forgetting something evident but I can't seem to find a way to assign a value if it validates a condition remaining as DRY as possible... Some code to explain what I mean ...
a = (b > 1) ? b : c;
or even a = (a > 1) ? a : b;
So of course here it's no big deal but if a was to be replaced by an method call, (maybe a yield return there) or whatever, I would then have to call it twice...
Only thing I see is stocking it in a variable which would then be as the code above...
Any better idea?
Aucun commentaire:
Enregistrer un commentaire