out parameter problem

M

mei xiao

Hi,

In my web service method (written in C#), I have a method like public string
myMethod(out int[] test1, string test1)

but when I use a web client to access this method, I got a run time
exception: System.NullReferenceException: object reference not set to an
instatnce to an object. What could be the problem and how to fix it? Thank
you very much.

-May
 
A

Alfred Taylor

Basically what the exception is telling you is that you're trying to
reference a method/property or do something else with a null-referenced
object. For example if you pass in null to the parameter test1 of
myMethod() and in the method try to do test1.ToString() you'll get the
NullReferenceException.

Look over the code and make sure you're not trying to do something similar
to the above. It's most likely not anything related to the out parameter.
You'd get a compile error (if i remember correctly) as opposed to an
exception if you don't properly set the out parameter.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top