TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
357
120.7k
Returning
Feb 18 2012 3:11 PM
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!
Reply
Answers (
2
)
BufferedGraphicsContext cannot be disposed of because a buffer operation is currently in progress
Tabs positioning