Given the following simple code snippet
// Worker method with implementation
public int DoCalculation(int receivingInt)
int multiply = receivingInt * 3;
return multiply;
// Caller method
public void CallerMethod(Object sender, Eventargs args)
int startingInt = 10;
int gettingVariable = DoCalculation(startingInt);
textbox1.text = gettingVariable.ToString();
The worker method has a method return type and therefore returns the int multiply variable which has stored the result from calling the DoCalculation method.
Now given the below code snippet
public Product GetProduct(int productId)
string sql = "some query implementation";
object[] parms = { "@ProductId", productId };
return DB.Read(sql, parms);
Why is the return keyword returning a static DB class and static Read method rather than return the local variables?
Ive never seen anything like this in methods where the return goes off to another method altogether, away from the usual worker and caller pattern...
Any more info needed please ask...
Cheers!