Welcome To Shadab's Blog

Programming Blog to learn C# , java, Sql Server 2005 and many more things.





About Me

My photo
Bokaro, Jharkhand, India

Saturday, December 19, 2009

Example of out parameter in C#

using System;
class out_demo
{
public void add(out int num)
{
num=90; //set the value in reference of num
}
public static void Main()
{
int num; //local variable but not initialized
out_demo obj=new out_demo();
obj.add(out num);
Console.WriteLine(num);
}
}

//output will be
//90
//now we can say that in case of out parameter value transfered out from the method named add()

No comments:

Post a Comment