i have this in a class:
public void fn_X(out Int32 j)
{
j = 5;
}
i call it by using:
reportFunctionsCS rfcs = new reportFunctionsCS();
Int32 j = 0;
rfcs.fn_X(j);
it always gives me this error:
CS1502: The best overloaded method match for 'reportFunctionsCS.fn_X(out
int)' has some invalid arguments
and i have no idea why, but i'm sure it's simple!!!

Signature
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)
kes
Nicholas Paldino [.NET/C# MVP] - 06 Sep 2007 15:58 GMT
kes,
When you have an "out" parameter, you have to declare out when making
the call as well, like so:
rfcs.fn_X(out j);

Signature
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
>i have this in a class:
> public void fn_X(out Int32 j)
[quoted text clipped - 10 lines]
> int)' has some invalid arguments
> and i have no idea why, but i'm sure it's simple!!!
WebBuilder451 - 06 Sep 2007 16:12 GMT
thanks!
This is one of those "Wayne's World, looking at Alice Cooper moments"
"... I was unaware of that..." And in truth i was NOT!
Thank you, very much appreciated

Signature
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)
kes
> kes,
>
[quoted text clipped - 17 lines]
> > int)' has some invalid arguments
> > and i have no idea why, but i'm sure it's simple!!!
Ignacio Machin ( .NET/ C# MVP ) - 06 Sep 2007 16:03 GMT
Hi,
You also have to use the out keyword when you are calling the method, this
is intended to be use as an indication for the calling code that the value
will be modify inside the method.
>i have this in a class:
> public void fn_X(out Int32 j)
[quoted text clipped - 10 lines]
> int)' has some invalid arguments
> and i have no idea why, but i'm sure it's simple!!!