Working with Parameter
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
namespace CSharp_Shell
{
public class Program
{
public static void Main()
{
/*
//Explaning value type and reference type and out keyword
int num1 = 5;
int num2 = 5;
int add, sub, mul, div;
//
method1(num1);
method2(ref num2);
//
//
Console.WriteLine(num1);
Console.WriteLine(num2);
//
calculation(num1, num2, out add, out sub, out mul, out div);
Console.WriteLine("{0} {1} {2} {3}", add, sub, mul, div);
*/
}
//
//
/*
public static int method1(int num1)
{
num1 = 10;
return 1;
}
public static int method2(ref int num2)
{
num2 = 10;
return 1;
}
public static void calculation(int num1, int num2, out int add, out int sub, out int mul, out int div)
{
add = num1 + num2;
sub = num1 - num2;
mul = num1 * num2;
div = num1 / num2;
}
*/
}
}
Comments
Post a Comment