if I have a function like
public void usefulUtility(parameters...) { string c = "select * from myDB"; do_a_database_call(c); }
which is used in many places, is there any possible harm in changing it:
public bool usefulUtility(parameters...) { string c = "select * from myDB"; bool result = do_a_database_call(c); return result; }
Could this break any code?
I can't think of anything ... but is this possible?
, , , , - . , , , , , , ( ), , , .
.
Action a = usefulUtility;
, , .
, fooobar.com/questions/36122/... , API- .
, , . , - .
, , - , - . , , , , . , - , .
You will need to actually return a String, or at least null for the method to compile. You can no longer finish the method without returning.
If you want to be absolutely sure that you won’t break anything, give a method that returns a String with a different name and leave the signature of the void method the same.