struct Increment
{
void increment(out int n)
{
n = 2;
n = n + 1;
Console.WriteLine("\n****in method my value is {0}", n);
}
static void Main()
{
int n ;
Console.WriteLine("Enter any no");
// n = int.Parse(Console.ReadLine());
//Console.WriteLine("\nBefore Calling method...My Value is {0}", n);
Increment o = new Increment();
o.increment(out n);
Console.WriteLine("\nAfter Calling method....My Value is {0}", n);
Console.WriteLine("Press any key to Exit");
Console.ReadKey();
}
}
{
void increment(out int n)
{
n = 2;
n = n + 1;
Console.WriteLine("\n****in method my value is {0}", n);
}
static void Main()
{
int n ;
Console.WriteLine("Enter any no");
// n = int.Parse(Console.ReadLine());
//Console.WriteLine("\nBefore Calling method...My Value is {0}", n);
Increment o = new Increment();
o.increment(out n);
Console.WriteLine("\nAfter Calling method....My Value is {0}", n);
Console.WriteLine("Press any key to Exit");
Console.ReadKey();
}
}
No comments:
Post a Comment