because you don't need the 'out' modifier at all. If all you are trying to
do is add an element to an array, then you are NOT modifying the value of
the Avalues variable. You are modifying the list that the variable points
to.
Remove the 'out' keyword and your method will not only compile, it will
work.
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"andrewcw" <an******@acw.com> wrote in message
news:29**********************************@microsof t.com...
Why is it that I get these errors on this function
1.) The out parameter 'Avalues' must be assigned to before control leaves
the current method
2.) Use of unassigned local variable 'Avalues'
public bool getStringFieldAsArrayList( out ArrayList Avalues)
{
bool retVal=false ;
Avalues.Add("fooAvalues");
return retVal;
}
BUT NOT for this:
public void getOutString( out string test)
{
test ="foo";
}
They seem to be constructed the same way...
-
Andrew