Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

  • *Experts*
Posted

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);

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...