Click here to Skip to main content
15,916,371 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
what is out and ref parameter?
Posted
Comments
[no name] 21-Aug-12 7:36am    
Is MSDN broken again?
[no name] 21-Aug-12 7:46am    
Read book and Search MSDN.
__TR__ 21-Aug-12 7:51am    
Please go through Code Project Quick Answers FAQ[^] before posting a question.

That is hidden inside the documentation[^].
 
Share this answer
 
SQL
ref- use to pass by reference in function argument
out-similar to ref but pass out value from the function..below example


class Test
{
void refDemo(ref int i)
{
i= i*10;
}
int FindDecimal(float f,out float dp)
{
int i=(int) f;
dp=f-i;
return i;
}
}

class RefExample
{
public static void Main(string []args)
{
Test obj=new Test();
int i=10;
Console.WriteLine("Before Call i:" + i);
obj.refDemo(ref i);
Console.WriteLine("After Call i:" + i);
obj.FindDecimal(12.2345f,out float f);
Console.WriteLine("Decimal points f:" + f);
}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900