veger Posted May 19, 2005 Posted May 19, 2005 I am calling a webservice that will return multiple integer values, so I assume the best way to do so is pass the variables by ref, right? So I define my variables, and call the webservice... int foo; ret = mywebservice.mymethod( ref foo); But I get a compilation error: "use of unassigned local variable 'foo'" Since the purpose of the webservice function is to populate foo, surely I don't have to populate foo before calling the function? Quote
*Experts* mutant Posted May 19, 2005 *Experts* Posted May 19, 2005 Either initialize the variable with an initial value, or use the out parameters. I recommend you look through MSDN to check the differences between the two. int hello = 10; DoHello(ref hello); Quote
Administrators PlausiblyDamp Posted May 19, 2005 Administrators Posted May 19, 2005 You could also create a class that exposes the returned values as properties and return an instance of the class. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.