the value to "out" parameter must be assigned in the method body,
otherwise the method will not be compiled
I have the following code in c#
class Sample{
public void sum(out int num1,int num2)
{
}
public void print()
{ int i=12;
sum(out i,10);
Console.WriteLine(i);
}
}
why the following code give error saying "the out parameter 'num1' must be
assigned before control leaves the current method",even i am not writing
any statement there or not using num1 and i already assign it the value in
callee method?
No comments:
Post a Comment