Sunday, 22 August 2010

source code for different function with return

//source code for different function with return
using System;
namespace OOPSProj
{
class Program
{
static void Main(string[] args)
{
Program p = new Program();
p.Test11();
p.Test22(2);
Console.WriteLine(p.Test33());
Console.WriteLine(p.Test44("leejo"));
int b = 0;
int a = p.Test55(100, 50, ref b);
Console.WriteLine(a + " " + b);
Console.ReadLine();
}
//No Input No Output
void Test11()
{
Console.WriteLine("First Method");
}
//No Output Has Input
void Test22(int x)
{
Console.WriteLine("Second Method: " + x);
}
//No Input Has Output
string Test33()
{
return "Third Method";
}
//Has Input & Output
string Test44(string name)
{
return "Hello " + name;
}
//Has Input & Multiple Outputs
int Test55(int x, int y, ref int z)
{
z = x * y;
return x + y;
}
}
}